set.seed(123)
data <- data.frame(ID = 1:10,
weight_hus = rnorm(10, 0, 1),
weight_wife = rnorm(10, 0, 1),
height_hus = rnorm(10, 0, 1),
height_wife = rnorm(10, 0, 1))
我正在try 使用rehape()函数
(由于某些原因,我不能使用tidyVerse函数或其他包的函数. 我想使用rehape()函数)
data2 <- reshape(data = data,
idvar = "ID",
seperator = "_",
direction = "long",
v.name = c("body"),
timevar = c("hus", wife)
)
但它从来都不管用.