[R] Value lables, variable lables
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Nov 28 19:16:28 CET 2001
We've been here before, so check the archives.
Aren't they labels, not lables?
R can use sensible names directly. In particular, given S/R has factors,
I don't see that `variable lables' add anything:
gender <- factor(c(0,1,1), labels=c("Male", "Female"))
seems all you need.
There are also comment attributes in R:
VAR001 <- gender
comment(VAR001) <- "Gender of Respondent"
which might play the role of "variable lable" if you really can't use
On Wed, 28 Nov 2001, Paul E Johnson wrote:
> I'm looking for an analogy to SPSS and "variable lable" and "value
> lable" in R. I have a copy of S+4.0 and can't find any info in their
> docs, and don't find it in R-intro either.
> In SPSS, for each variable, there is a name like
> and a variable lable (a longer descriptive string) like
> Respondent ID
> and for many of the values of other variables there are value lables.
> For example, VAR008 has the lable
> GENDER of Respondent
> and it has values of 0 and 1, and the values are labled
> 0 Male
> 1 Female
> Sometimes value lables are much longer strings.
> Whenever a person runs a model in SPSS, the printout automatically finds
> the lable and prints it along with the variable name and the values are
> replaced by their lables.
> In R, does one keep a list of variable lables and value lables? If so,
> where? It seems to me that an R collection type like Map or Hash would
> be needed so one could put in a variable name and get back a lable.
> Paul E. Johnson email: pauljohn at ukans.edu
> Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
> University of Kansas Office: (785) 864-9086
> Lawrence, Kansas 66045 FAX: (785) 864-5700
> 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
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
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