R Loop To New Data Frame Summary Weighted
问题 I have a tall data frame as such: data = data.frame("id"=c(1,2,3,4,5,6,7,8,9,10), "group"=c(1,1,2,1,2,2,2,2,1,2), "type"=c(1,1,2,3,2,2,3,3,3,1), "score1"=c(sample(1:4,10,r=T)), "score2"=c(sample(1:4,10,r=T)), "score3"=c(sample(1:4,10,r=T)), "score4"=c(sample(1:4,10,r=T)), "score5"=c(sample(1:4,10,r=T)), "weight1"=c(173,109,136,189,186,146,173,102,178,174), "weight2"=c(147,187,125,126,120,165,142,129,144,197), "weight3"=c(103,192,102,159,128,179,195,193,135,145), "weight4"=c(114,182,199,101