从宽到长(变化)和长度(倍)相同的列,但仍然出错

时间:2019-07-25 12:01:21

标签: r panel reshape

我想将df从宽变到长。因此,我使用以下代码:

reshape(a, direction = "long", varying = c(list(names(a)[1:12])), v.names = "a", 
        idvar = c("participant_id"), timevar = "s", times = c(list(names(a)[1:12])))

althouhg变化,并且时间定义在同一列中,我收到一条错误消息,

Error in reshapeLong(data, idvar = idvar, timevar = timevar, varying = varying,  : 
  'lengths(varying)' must all match 'length(times)'

当它们是相同的列时,我真的不知道长度如何变化吗?

0 个答案:

没有答案