[R] Newbie struggling with "factors"
Tom Arnold
thomas_l_arnold at yahoo.com
Fri Mar 29 14:58:45 CET 2002
I am processing some survey results, and my data are
being read in as "factors". I don't know how to
process these things in any way.
To start with, several of the survey questions are
mulit-choice check boxes on the original (web-based)
survey, as in "check all that apply".
These are encoded as numbers. For example, if the
survey has a question:
Which operating systems have you used? (Check all that
apply)
[ ]Windows
[ ]Macinotsh
[ ]Unix
...then the data exported for three different
responses might look like
;1;
;1,3;
;1,2,3;
...where ";" is the field delimiter.
I use read.table to get the data in. I read all the
survey data into a table "n" and the field above is
called "OSUSE". When I query R about the field, it
tells me it is class "factor"
> class(n$OSUSE)
[1] "factor"
> mode(n$OSUSE)
[1] "numeric"
I'd like to be able to do some simple things like:
what is the most common item checked (1, 2, or 3?)
What is the average number of boxes checked?
But I can't find any way to manipulate this "factor"
field. What's the secret?
Thanks.
=====
Tom Arnold
Summit Media Partners
Visit our web site at http://www.summitmediapartners.com
__________________________________________________
Yahoo! Greetings - send holiday greetings for Easter, Passover
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list