I have a DF that I want to transpose rows and columns and group (distinct count) the number of ID's. My example:
ID<- c(111,222,111,222,333,111,222,333)
AGE_GROUP<- c("30_40","30_40","30_40","30_40","50_60","30_40","30_40","50_60")
DATE<-c("JAN","JAN","FEB","FEB","FEB","MAR","MAR","MAR")
DF<-data.frame(ID,AGE_GROUP,DATE)
The result I wish to have.My new DF:
AGE_GROUP<- c("30_40","50_60")
JAN<- c(2,0)
FEB<- c(2,1)
MAR<- c(2,1)
DF2<-data.frame(AGE_GROUP,JAN,FEB,MAR)
How would I do this grouping and transposition?