[R] Recoding scores of negatively worded item

Gabor Grothendieck ggrothendieck at myway.com
Sat Jul 3 19:17:38 CEST 2004


Jonathan Baron <baron <at> psych.upenn.edu> writes:


: ces$score <- ifelse(ces$question %in% c(1,3,5),5-ces$score,ces$score)

One minor improvement in readability might be:

ces$score <- with(ces, ifelse(question %in% c(1,3,5), 5-score, score))




More information about the R-help mailing list