Hello,
This should be rather simple, I would like to expand rows of my data set. The criteria to expand the rows is equal to a value in a specified column. In my code below that column is row_nbr2. Currently I can expand my rows the way I want however, the functions deletes all but two columns. I have two different ways of expanding my data set:
test<-df%>%group_by(id)%>%expand(md=seq(1:row_nbr2))
test<-df[,list(md=rep(1,row_nbr2)),by="id"]
I am grouping by id, creating a new column called 'md' and expanding the rows equal to the value in the row_nbr2 column.
Any thoughts?