Fwd: R-beta: Printing

Hubert Palme palme at uni-wuppertal.de
Mon Mar 16 16:53:24 CET 1998

Thomas Lumley: 
 > >Another question: Is there any simple way to assign value labels?
 >  Some of the functions of variable labels in eg SPSS are performed by
 > factor levels, so if you use
 > 	x<-factor(x,labels=c("first level","second level","third level"))
 > the factor labels will usually appear in output. read.table() converts
 > non-numeric data to factors by default, which means that the data file can
 > contain labels instead of the data.

OK. I had to add 'levels=1:n' (number of values), otherwise R complains
about labels for values not present in tha data. Now it works fine.

Next stupid question:-)

Is there a similar way to assign variable labels (besides the names,
of course)?

Thanks a lot for your help!

Hubert Palme         Bergische Universitaet-Gesamthochschule Wuppertal
                                      Computing  Center
                                      D-42097 Wuppertal
Email: palme at uni-wuppertal.de             (Germany)
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