Hello there, I try to construct a variable with R, but I have some difficulties.
Assume that I use a data set named = mydata. I want to create a variable that is the mean (totmean) or the sum (totsum) of 6 variables (var1, var2, var3, var4, var5, var6). However, I want only participants who have responded to at least 4 items to be include. Those who have one or two missing for var1-var6 should be coded NA for totmean and totsum. How I do that? Thank you! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.