I have been trying to use panelr and then other packages to reshape from wide to long. Here are my variables:

I tried using panelr's long_panel ('merg_Liz_OSARI_MCST' is the name of the dataframe I am using):
panel_long <- merg_Liz_OSARI_MCST %>%
panelr::long_panel(
id = "id_number", # existing variable that indexes unique cases
`wave = "time", # name of the NEW time variable you want
begin = 1, # first time-related variable suffix in wide data
end = 3
)
I also tried using older packages:
merge_long <- merg_Liz_OSARI_MCST |>
pivot_longer(cols = N_negRT_1:num_go_trials_block_2_3,
names_to = "Variable",
values_to = "Value")
I also tried:
start_pos <- which(names(merg_Liz_OSARI_MCST) == "N_negRT_1")
end_pos <- which(names(merg_Liz_OSARI_MCST) == "num_go_trials_block_2_3")
# Select the variables to reshape
measure_vars <- names(merg_Liz_OSARI_MCST)[start_pos:end_pos]
# Reshape the data
merge_long <- melt(merg_Liz_OSARI_MCST, na.rm = FALSE, value.name = "time", measure.vars = measure_vars, id.vars = "id_number")
I can't get anything to work. What can I try next?
I have removed all variables that appeared only in wave 1 and 2 but not 3. I also tried ensuring all variables are in the same order for each wave, but this didn't help.