I have the following data frame:
id<-c(1,2,3,4,1,1,2,3,4,4,2,2) period<-c(\"first\",\"calib\",\"valid\",\"valid\",\"calib\",\"first\",\"valid\",\"valid\",\