Rcode:
`WR_edu5.3 <- data.frame(WTREDUC1.2=c("0","1"),
sd_age=mean(new_inc$sd_age),
sd_BMI=mean(new_inc$sd_BMI),
sd_FBG=mean(new_inc$sd_FBG),
sd_SBP=mean(new_inc$sd_SBP),
sd_DBP=mean(new_inc$sd_DBP),
sd_TG=mean(new_inc$sd_TG),
sd_HDL=mean(new_inc$sd_HDL),
hispanic1.2=c("0","1"),
RACER1.2=c("0","1","2"),
REGIONOFF1.2=c("0","1","2","3"),
PAYTYPER1.2=c("0","1","2","3","4","5"),
DIETNUTR1.2=c("0","1"))`
错误:data.frame中出现错误(WTREDUC1.2 = c(“ 0”,“ 1”),sd_age =平均值(new_inc $ sd_age),: 参数暗示不同的行数:2、1、3、4、6
因子变量:WTREDUC1.2,西班牙文1.2,RACER1.2,REGIONOFF1.2,PAYTYPER1.2,DIETNUTR1.2 创建的变量,这样每个值将保持相对于从数据集new_inc中原始数据条目计算得出的平均值不变。 sd_age ..等
我通过阅读类似的帖子尝试了几件事,但是没有用:
data.frame(word = do.call(c, WR_edu5.3),
group = rep(1:length(WR_edu5.3),
sapply(WR_edu5.3, length)))
require(reshape2)
melt(WR_edu5.3)
require(reshape2)
WR_edu5.3$id <- rownames(WR_edu5.3)
melt(WR_edu5.3)
我感谢任何建议。 谢谢。