I have a wide dataset which I would like to convert to a long format and split the columns into two groups; in the summary example below, variable score n.1 would be group 1 and variable score n.2. How do I convert a wide format data frame into a long format data frame and assign a group to the respective variables?
age.1<- c(23,34,52,12,23)
score1.1 <- c(44,23,62,1,0)
score2.1<- c(3,4,2,1,3)
score3.1<- c(230,304,502,102,203)
score1.2<- c(2343,4534,5652,1642,2233)
score1.2<- c(2233,32324,5232,1232,2233)
score2.2<- c(12323,12334,1352,1312,1323)
score3.2<- c(21233,33454,53452,12452,23532523)
df<- data.frame(age.1, score1.1,score2.1, score3.1, score1.2, score2.2, score3.2)