This function takes panel_data() objects as input as converts them to wide format for use in SEM and other situations when such a format is needed.

widen_panel(data, separator = "_", ignore.attributes = FALSE, varying = NULL)

## Arguments

data The panel_data frame. When the variables are labeled with the wave number, what should separate the variable name and wave number? By default, it is "_". In other words, a variable named var will be var_1, var_2, and so on in the wide data frame. If the data was created by long_panel(), it stores information about which variables vary over time and which are constants. Sometimes, though, this information is not accurate ( it is only based on the wide data's variable names) and you may want to force this function to check again based on the actual values of the variables. If you want to skip the checks for whether variables are varying and specify yourself, as is done with stats::reshape(), you can supply them as a vector here.

## Value

A data.frame with 1 row per respondent.

## Details

This is a wrapper for stats::reshape(), which is renowned for being pretty confusing to use. This function automatically detects which of the variables vary over time and which don't, not appending wave information to constants.

reshape

wide_wages <- widen_panel(wages)