I'm an R newbie who is struggling with some basic problems relating to factors for an analysis of likert items on a survey.
Specifically, there are two issues I'm struggling with - first, I'm not sure how to change similar factor names across columns of a data frame, and second, I'm looking for an efficient and easy way to collapse factor categories simultaneously across multiple columns of a data frame. For example, if columns 1 to 3 all have a seven-point scale of "Extremely dissatisfied", "Moderately dissatisfied", etc, etc, up to "Extremely satisfied", how do I collapse categories into "Dissatisfied" and "Satisfied", simultaneously across all three columns?
I'm also hoping to achieve this while working with a data frame instead of transforming to a matrix, or other data object. Perhaps my understanding of factors needs improving, but I'm aware that factors have an underlying number. I'm hoping to find a method to achieve the results while using the factor names, and not referring to the numbers. Or am I missing something obvious about factors here?
I have played around with recode from the car package, but I feel that there is probably an easier way. I also haven't been able to use recode across multiple columns by using an apply function. Is there a way to use the Plyr or Dplyr packages for this type of multi-column recoding?
Similarly, what's the easiest way to rename similar factors across columns simultaneously? For example, renaming "Extremely satisfied" to "Ext. sat" across columns 1 to 3.
Do I use "apply" or "lapply" together with a function?
I have searched and Googled for an answer to what seems like it should be a relatively easy and common task in R, but couldn't find anything that worked or was simple enough for me to understand.
Any suggestions would be greatly appreciated! This is also my first Stack overflow post, so let me know how I can improve my question format, wording, etc.
Thanks! Mike