Marion Wenty <marion.wenty <at> gmail.com> writes:

> I have got a question concerning the underlying numerical codes when
> reading an SPSS file into R.
> 
> I used the package foreign and when I look at a variable I get the verbal
> codes.
> 
> I would like to know how it is possible to get the underlying numerical
> codes as output, which are the same as in my SPSS file.
> 


You don't need to import both numerical and text values;  
R can automatically assign numerical values for 
factors: see ?as.numeric.

The default sorting of factor levels in R is alphabetical.  
To change this, see the "levels" argument of the 
factor command: ?factor


Hope this helps,

Michael Bibo
Queensland Health

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to