wide to long multiple measures each time

后端 未结 5 1370
慢半拍i
慢半拍i 2020-12-01 06:45

I know the wide to long has been asked way too many times on here but I can\'t figure out how to turn the following into long format. Shoot I even asked one of the wide to

5条回答
  •  时光说笑
    2020-12-01 07:25

    If you really didn't want the "T" in the "time" variable in the output, couldn't you simply do the following?

    names(DF) = sub("T", "", names(DF))
    reshape(DF, direction="long", varying=3:10)
    

    Or, without changing names(DF), you could simply set the sep= argument to include "T":

    reshape(DF, direction="long", varying=3:10, sep=".T")
    

    I'm a bit confused, though. As Ben Bolker pointed out a in his comment, your "dataset code" doesn't provide the same numbers as what you have. Also, the output of DWin and mine matches perfectly, but it does not match with the "into this" output that you have in your original question.

    I checked this by creating one data frame named "DWin" with his results, and one data frame named "mine" with my results and compared them using DWin == mine.

    Can you verify that the output we've gotten is actually what you needed?

提交回复
热议问题