I have a data set looking at 22.000 individuals. However there is a time variable to it telling me when this individual was observed the first time and when the last time. So I produced an additional column that tells me the absolute number of quarters that the individual was observed. Now I want to make this dataset a panel data set and replicate each individual by the number of quarter it has been observed. I found this question
Replicate each row of data.frame and specify the number of replications for each row
which matches my concern very well. but punching in the code:
df.expanded <- df[rep(seq(nrow(df)), df$Quartale), 1:2]
"Quartale" is name of the Var for quarters produces this error: Error in df$Quatarle : object of type 'closure' is not subsettable