panel_data
object class: A modified tibble, which is itself a modified data.frame.
Groupwise operations: panel_data
frames are grouped by entity, so many operations (e.g., mean(), cumsum()) are performed by dplyr’s mutate()
panel_data
frames are in “long” format, in which each row is a unique combination of entity and time point.
The package includes an example dataset called WageData
, which comes from the Panel Study of Income Dynamics.
Let’s see the first 14 observations
## Observations: 4,165
## Variables: 14
## $ exp <dbl> 3, 4, 5, 6, 7, 8, 9, 30, 31, 32, 33, 34, 35, 36, 6, 7, 8, 9, 10…
## $ wks <dbl> 32, 43, 40, 39, 42, 35, 32, 34, 27, 33, 30, 30, 37, 30, 50, 51,…
## $ occ <dbl> 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ ind <dbl> 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ south <dbl> 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ smsa <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ ms <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, …
## $ fem <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ union <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, …
## $ ed <dbl> 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12…
## $ blk <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ lwage <dbl> 5.56, 5.72, 6.00, 6.00, 6.06, 6.17, 6.24, 6.16, 6.21, 6.26, 6.5…
## $ t <dbl> 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, …
## $ id <dbl> 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, …
The key columns are id
and t
. They indicate which respondent (i
) and which time point (t
) the row refers to.
Let’s convert the data into a panel_data
frame.
panel_data
dataframepanel_data()
needs to know the id
and wave
columns so that it can protect them (and you) against accidentally being dropped, re-ordered, and so on.
Note that the wages
data are grouped by id
and sorted by t
within each id
. So you can calculate group means and create lagged variables without concerns
For more details about the panel_data()
function: https://panelr.jacob-long.com/reference/panel_data.html
wages <- wages %>%
mutate(
wks_mean = mean(wks), # this is the person-level mean (based on the time variation)
wks_lag = lag(wks), # this will have a value of NA when t = 1
wage = exp(lwage), # the the anti log
cumu_wages = cumsum(exp(lwage)) # cumulative summation works within person
)
id
and t
ride along even though we didn’t explicitly ask for them.By default, it provies descriptive statistics for each variable in each year
describe_panel_by_year <- summary(wages, union, lwage)
describe_panel_by_year %>%
kable() %>%
kable_styling()
skim_type | skim_variable | t | n_missing | complete_rate | numeric.mean | numeric.sd | numeric.p0 | numeric.p25 | numeric.p50 | numeric.p75 | numeric.p100 | numeric.hist |
---|---|---|---|---|---|---|---|---|---|---|---|---|
numeric | union | 1 | 0 | 1 | 0.361 | 0.481 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▅ |
numeric | union | 2 | 0 | 1 | 0.348 | 0.477 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▅ |
numeric | union | 3 | 0 | 1 | 0.370 | 0.483 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▅ |
numeric | union | 4 | 0 | 1 | 0.373 | 0.484 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▅ |
numeric | union | 5 | 0 | 1 | 0.366 | 0.482 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▅ |
numeric | union | 6 | 0 | 1 | 0.363 | 0.481 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▅ |
numeric | union | 7 | 0 | 1 | 0.366 | 0.482 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▅ |
numeric | lwage | 1 | 0 | 1 | 6.375 | 0.388 | 5.01 | 6.12 | 6.42 | 6.65 | 6.91 | ▁▂▃▇▇ |
numeric | lwage | 2 | 0 | 1 | 6.465 | 0.363 | 5.01 | 6.24 | 6.53 | 6.75 | 6.91 | ▁▁▂▅▇ |
numeric | lwage | 3 | 0 | 1 | 6.597 | 0.447 | 4.61 | 6.33 | 6.61 | 6.86 | 8.27 | ▁▂▇▃▁ |
numeric | lwage | 4 | 0 | 1 | 6.696 | 0.441 | 5.08 | 6.44 | 6.71 | 6.96 | 8.52 | ▁▃▇▂▁ |
numeric | lwage | 5 | 0 | 1 | 6.786 | 0.424 | 5.27 | 6.51 | 6.80 | 7.04 | 8.10 | ▁▂▇▅▁ |
numeric | lwage | 6 | 0 | 1 | 6.864 | 0.424 | 5.66 | 6.60 | 6.91 | 7.11 | 8.16 | ▁▃▇▃▁ |
numeric | lwage | 7 | 0 | 1 | 6.951 | 0.438 | 5.68 | 6.68 | 6.99 | 7.21 | 8.54 | ▁▅▇▂▁ |
Stop getting per-year statistics by setting by.wave = FALSE
For dataset with few entities, per-entity statistics can be obtained by setting by.wave = FALSE
and by.id = TRUE.
For furthe details, see the documentio of the function: https://panelr.jacob-long.com/reference/summary.panel_data.html
subset.ids = filter(penn, g7 == 1)$country,
penn %>%
line_plot(realxrate,
overlay = FALSE,
subset.ids = filter(penn, g7 == 1)$country,
add.mean = TRUE)
penn %>%
line_plot(realxrate,
overlay = FALSE,
subset.ids = filter(penn, g7 == 1)$country,
add.mean = TRUE,
mean.function = "loess"
)
panel_data
objectid
and a row for each t
## Observations: 595
## Variables: 89
## $ id <fct> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…
## $ fem <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,…
## $ ed <dbl> 9, 11, 12, 10, 16, 12, 12, 10, 16, 16, 12, 12, 12, 17, 1…
## $ blk <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,…
## $ wks_mean <dbl> 37.6, 31.6, 50.4, 47.9, 47.0, 45.9, 47.3, 49.6, 48.0, 43…
## $ exp_1 <dbl> 3, 30, 6, 31, 10, 26, 15, 23, 3, 3, 24, 21, 26, 15, 9, 1…
## $ wks_1 <dbl> 32, 34, 50, 52, 50, 44, 46, 51, 50, 49, 47, 47, 48, 45, …
## $ occ_1 <dbl> 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1,…
## $ ind_1 <dbl> 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,…
## $ south_1 <dbl> 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,…
## $ smsa_1 <dbl> 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1,…
## $ ms_1 <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1,…
## $ union_1 <dbl> 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1,…
## $ lwage_1 <dbl> 5.56, 6.16, 5.65, 6.16, 6.44, 6.91, 6.13, 6.33, 6.55, 6.…
## $ wks_lag_1 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
## $ wage_1 <dbl> 260, 475, 285, 472, 625, 998, 461, 562, 700, 600, 779, 7…
## $ cumu_wages_1 <dbl> 260, 475, 285, 472, 625, 998, 461, 562, 700, 600, 779, 7…
## $ exp_2 <dbl> 4, 31, 7, 32, 11, 27, 16, 24, 4, 4, 25, 22, 27, 16, 10, …
## $ wks_2 <dbl> 43, 27, 51, 46, 46, 47, 48, 50, 48, 47, 48, 46, 48, 45, …
## $ occ_2 <dbl> 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1,…
## $ ind_2 <dbl> 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,…
## $ south_2 <dbl> 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,…
## $ smsa_2 <dbl> 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1,…
## $ ms_2 <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1,…
## $ union_2 <dbl> 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1,…
## $ lwage_2 <dbl> 5.72, 6.21, 6.44, 6.24, 6.62, 6.91, 6.17, 6.40, 6.55, 6.…
## $ wks_lag_2 <dbl> 32, 34, 50, 52, 50, 44, 46, 51, 50, 49, 47, 47, 48, 45, …
## $ wage_2 <dbl> 305, 500, 624, 512, 750, 998, 480, 604, 700, 625, 834, 7…
## $ cumu_wages_2 <dbl> 565, 975, 909, 984, 1375, 1996, 941, 1166, 1400, 1225, 1…
## $ exp_3 <dbl> 5, 32, 8, 33, 12, 28, 17, 25, 5, 5, 26, 23, 28, 17, 11, …
## $ wks_3 <dbl> 40, 33, 50, 46, 40, 47, 49, 50, 50, 46, 45, 47, 50, 45, …
## $ occ_3 <dbl> 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1,…
## $ ind_3 <dbl> 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,…
## $ south_3 <dbl> 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,…
## $ smsa_3 <dbl> 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1,…
## $ ms_3 <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1,…
## $ union_3 <dbl> 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1,…
## $ lwage_3 <dbl> 6.00, 6.26, 6.55, 6.30, 6.63, 6.91, 6.21, 6.54, 6.80, 6.…
## $ wks_lag_3 <dbl> 43, 27, 51, 46, 46, 47, 48, 50, 48, 47, 48, 46, 48, 45, …
## $ wage_3 <dbl> 402, 525, 698, 545, 760, 1000, 499, 695, 900, 625, 900, …
## $ cumu_wages_3 <dbl> 967, 1500, 1607, 1529, 2135, 2996, 1440, 1861, 2300, 185…
## $ exp_4 <dbl> 6, 33, 9, 34, 13, 29, 18, 26, 6, 6, 27, 24, 29, 18, 12, …
## $ wks_4 <dbl> 39, 30, 52, 49, 50, 47, 46, 50, 48, 44, 45, 47, 48, 44, …
## $ occ_4 <dbl> 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1,…
## $ ind_4 <dbl> 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,…
## $ south_4 <dbl> 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,…
## $ smsa_4 <dbl> 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1,…
## $ ms_4 <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1,…
## $ union_4 <dbl> 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1,…
## $ lwage_4 <dbl> 6.00, 6.54, 6.60, 6.36, 6.98, 7.00, 6.31, 6.56, 6.91, 6.…
## $ wks_lag_4 <dbl> 40, 33, 50, 46, 40, 47, 49, 50, 50, 46, 45, 47, 50, 45, …
## $ wage_4 <dbl> 402, 695, 737, 578, 1078, 1100, 552, 708, 1000, 625, 100…
## $ cumu_wages_4 <dbl> 1369, 2195, 2344, 2107, 3213, 4096, 1992, 2569, 3300, 24…
## $ exp_5 <dbl> 7, 34, 10, 35, 14, 30, 19, 27, 7, 7, 28, 25, 30, 19, 13,…
## $ wks_5 <dbl> 42, 30, 52, 44, 47, 44, 47, 44, 48, 43, 47, 47, 48, 44, …
## $ occ_5 <dbl> 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1,…
## $ ind_5 <dbl> 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,…
## $ south_5 <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,…
## $ smsa_5 <dbl> 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1,…
## $ ms_5 <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1,…
## $ union_5 <dbl> 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1,…
## $ lwage_5 <dbl> 6.06, 6.70, 6.70, 6.47, 7.05, 7.07, 6.38, 6.59, 7.09, 6.…
## $ wks_lag_5 <dbl> 39, 30, 52, 49, 50, 47, 46, 50, 48, 44, 45, 47, 48, 44, …
## $ wage_5 <dbl> 429, 810, 809, 645, 1150, 1175, 587, 729, 1200, 680, 114…
## $ cumu_wages_5 <dbl> 1798, 3005, 3153, 2752, 4363, 5271, 2579, 3298, 4500, 31…
## $ exp_6 <dbl> 8, 35, 11, 36, 15, 31, 20, 28, 8, 8, 29, 26, 31, 20, 14,…
## $ wks_6 <dbl> 35, 37, 52, 52, 47, 45, 47, 51, 44, 34, 17, 47, 46, 44, …
## $ occ_6 <dbl> 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1,…
## $ ind_6 <dbl> 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,…
## $ south_6 <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,…
## $ smsa_6 <dbl> 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1,…
## $ ms_6 <dbl> 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1,…
## $ union_6 <dbl> 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1,…
## $ lwage_6 <dbl> 6.17, 6.79, 6.78, 6.56, 7.31, 7.52, 6.45, 6.82, 7.17, 6.…
## $ wks_lag_6 <dbl> 42, 30, 52, 44, 47, 44, 47, 44, 48, 43, 47, 47, 48, 44, …
## $ wage_6 <dbl> 480, 890, 879, 708, 1500, 1845, 630, 914, 1300, 745, 124…
## $ cumu_wages_6 <dbl> 2278, 3895, 4032, 3460, 5863, 7116, 3209, 4212, 5800, 39…
## $ exp_7 <dbl> 9, 36, 12, 37, 16, 32, 21, 29, 9, 9, 30, 27, 32, 21, 15,…
## $ wks_7 <dbl> 32, 30, 46, 46, 49, 47, 48, 51, 48, 40, 47, 46, 46, 44, …
## $ occ_7 <dbl> 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1,…
## $ ind_7 <dbl> 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,…
## $ south_7 <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,…
## $ smsa_7 <dbl> 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1,…
## $ ms_7 <dbl> 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1,…
## $ union_7 <dbl> 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1,…
## $ lwage_7 <dbl> 6.24, 6.82, 6.86, 6.62, 7.30, 7.34, 6.52, 6.89, 7.21, 6.…
## $ wks_lag_7 <dbl> 35, 37, 52, 52, 47, 45, 47, 51, 44, 34, 17, 47, 46, 44, …
## $ wage_7 <dbl> 515, 912, 954, 751, 1474, 1539, 680, 984, 1350, 845, 140…
## $ cumu_wages_7 <dbl> 2793, 4807, 4986, 4211, 7337, 8655, 3889, 5196, 7150, 47…
Is is importnat to know how many waves there are, which variables change over time, and how the time-varying variables are labeled.
Let’s load a wide dataset
## Observations: 1,151
## Variables: 28
## $ id <dbl> 22, 75, 92, 96, 141, 161, 220, 229, 236, 240, 245, 249, 255…
## $ pov1 <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,…
## $ mother1 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,…
## $ spouse1 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ inschool1 <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,…
## $ hours1 <dbl> 21, 8, 30, 19, 0, 0, 6, 0, 0, 18, 0, 0, 0, 12, 0, 19, 25, 2…
## $ pov2 <dbl> 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0,…
## $ mother2 <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,…
## $ spouse2 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,…
## $ inschool2 <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0,…
## $ hours2 <dbl> 15, 0, 27, 54, 6, 15, 8, 32, 20, 0, 0, 0, 23, 0, 0, 20, 30,…
## $ pov3 <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0,…
## $ mother3 <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1,…
## $ spouse3 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,…
## $ inschool3 <dbl> 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,…
## $ hours3 <dbl> 3, 0, 24, 0, 0, 37, 6, 0, 0, 0, 0, 30, 23, 0, 0, 0, 20, 55,…
## $ pov4 <dbl> 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1,…
## $ mother4 <dbl> 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1,…
## $ spouse4 <dbl> 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,…
## $ inschool4 <dbl> 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,…
## $ hours4 <dbl> 0, 4, 31, 26, 0, 0, 12, 15, 40, 85, 0, 0, 58, 0, 0, 27, 38,…
## $ age <dbl> 16, 17, 16, 17, 16, 17, 17, 16, 17, 16, 16, 16, 16, 17, 16,…
## $ black <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,…
## $ pov5 <dbl> 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,…
## $ mother5 <dbl> 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1,…
## $ spouse5 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,…
## $ inschool5 <dbl> 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,…
## $ hours5 <dbl> 0, 0, 0, 36, 0, 0, 0, 20, 40, 90, 27, 0, 25, 12, 0, 46, 0, …
The long_panel()
needs to know what the waves are called (1, 2, 3, …), where the wave label is in the variable name (beginning or end), and whether the label has prefixes or suffixes (e.g., “W1_variable” has a “W” prefix and “_” suffix).
We have no prefix/suffix, the label is at the end, and the labels go from 1 to 5.