我想将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)'
当它们是相同的列时,我真的不知道长度如何变化吗?