Re: [R] [R Survey Analysis] Problem counting number of responses

2016-08-16 Thread Jim Lemon
Hi Lauren, As Sarah noted, if your blank responses are coming as NAs, it may be best to leave them alone until you have done the calculations: survey$responses<-!is.na(survey[,c("q1","q2","q3")]) survey$sum_survey<-rowSums(survey[,c("q1","q2","q3")],na.rm=TRUE) # the next line returns a logical

Re: [R] [R Survey Analysis] Problem counting number of responses

2016-08-16 Thread Sarah Goslee
Hi Lauren, I'm not entirely sure what your sample code is suppoesd to do, since it isn't complete R code, and it would be much easier to answer your question if you provided sample data and didn't post in HTML. dput(head(survey)) would be enough sample data, most likely. But if I'm

Re: [R] [R Survey Analysis] Problem counting number of responses

2016-08-16 Thread Greg Snow
Lauren, The easier that you make it for us to help you, the more likely you are to get help and the more helpful the answers will be. First, please post in plain text (not HTML). Second, reproducible code (including sample data) helps us help you. Your code above is incorrect, the 3 lines with

[R] [R Survey Analysis] Problem counting number of responses

2016-08-16 Thread Lauren Bolger
M ​y dataset includes a survey completed by research participants to evaluate quality of life. A few things regarding the survey: - *not all questions must be answered​ for the total score * - questions left blank are coded as "0" - ​the number of questions answered must be determined