widen_panel {panelr} | R Documentation |
Convert long panel data to wide format
Description
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.
Usage
widen_panel(data, separator = "_", ignore.attributes = FALSE, varying = NULL)
Arguments
data |
The |
separator |
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 |
ignore.attributes |
If the |
varying |
If you want to skip the checks for whether variables are
varying and specify yourself, as is done with |
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.
Value
A data.frame with 1 row per respondent.
See Also
Examples
wages <- panel_data(WageData, id = id, wave = t)
wide_wages <- widen_panel(wages)