Reshaping several variables wide with cast

后端 未结 3 647
自闭症患者
自闭症患者 2020-12-16 03:56

I have a data.frame that looks like this:

> head(ff.df)
  .id pio caremgmt prev price surveyNum
1   1   2        2    1     2         1
2   1   2        1         


        
3条回答
  •  伪装坚强ぢ
    2020-12-16 04:22

    You can do this with the reshape function in base R. The column ordering is a little weird, but can be fixed easily.

     reshape(ff.df, direction = 'wide', idvar = "surveyNum", timevar = '.id')
    

提交回复
热议问题