Hello, I'm having trouble shifting the names into separate columns after I pivoted the data. As you can see in the screenshot, the AgeWave1 is supposed to in a separate column. Similarly, AgeWave2,... YPI1, and so on are all supposed to be in a separate column but it has to remain pivoted like this so I can run a repeated measures analysis. I tried using other like "names_sep = "_")" along with pivot longer i found on a Berkley site but that didnt work. Any information would be appreciated. Thank you.
Waves%>%
pivot_longer(!CaseID)->wave1
Waves <- tibble::tribble(
~CaseID, ~AgeWave1, ~AgeWave2, ~AgeWave3, ~AgeWave4, ~YPI1, ~YPI2, ~YPI3, ~YPI4, ~HIF1, ~HIF2, ~HIF3, ~HIF4,
1L, 12L, 23L, 24L, 25L, 123L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
2L, 13L, 23L, 24L, 26L, 123L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
3L, 14L, 23L, 24L, 25L, 232L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
4L, 12L, 23L, 24L, 26L, 123L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
5L, 14L, 23L, 23L, 26L, 2L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
6L, 13L, 23L, 24L, 25L, 123L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
7L, 14L, 23L, 23L, 25L, 32L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
8L, 14L, 23L, 23L, 25L, 123L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
9L, 14L, 23L, 24L, 26L, 2L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L,
10L, 13L, 23L, 23L, 25L, 123L, 124L, 132L, 123L, 131L, 12321L, 112L, 221L