[R] Basic question: Reading in multiple choice question responses to a single column in data frame

Magnus Torfason zulutime.net at gmail.com
Thu Aug 20 20:02:40 CEST 2009


On 8/19/2009 11:06 PM, Damion Dooley wrote:
> Slight addendum.  Working from your code, I found 1 line of code does the
> conversion:
> 
> 	myColumn = unlist(strsplit(as.character(myData[[myQuestion]]),","));
> 
> But the dataframe you set up may prove more useful.

I'm glad my suggestion was useful. My more comprehensive example assumed 
that you needed to be able to match individual multi-choice selections 
with other questions through the observation ID after the processing.
If that is not needed, the one-liner should be adequate.

Best,
Magnus




More information about the R-help mailing list