Hi, Is it possible to add labels to variables in R (so as to have a better description of what the variables represent)? Thanks, Neil
Check out the Hmisc library. -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Neil Leonard Sent: Tuesday, August 24, 2004 22:0 PM To: R-help at stat.math.ethz.ch Subject: [R] Adding labels to variables Hi, Is it possible to add labels to variables in R (so as to have a better description of what the variables represent)? Thanks, Neil ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Neil Leonard <nleonard <at> tartarus.uwa.edu.au> writes: : Is it possible to add labels to variables in R (so as to have a better : description of what the variables represent)? One can add arbitrarily named attributes to objects. For example, we can add an attribute which we shall call memo to object z: R> z <- 3 R> attr(z,"memo") <- "very important number" R> # sometime later R> z [1] 3 attr(,"memo") [1] "very important number"
References: <E7D5AB4811D20B489622AABA9C53859101F11190 at teal-exch.amgen.com> X-Mailer: VM 7.18 under Emacs 21.3.1 Reply-To: Martin Maechler <maechler at stat.math.ethz.ch> FCC: ~maechler/F/out --text follows this line-->>>>> "AustinM" == Austin, Matt <maustin at amgen.com> >>>>> on Tue, 24 Aug 2004 22:15:15 -0700 writes:AustinM> Check out the Hmisc library. It's a *package*, not a library ! Note that there are also the "comment" and "comment<-" function pair (in R's base) that you could use : > x <- 1:10 > comment(x) <- "this is the price of the R stock" > x [1] 1 2 3 4 5 6 7 8 9 10 > comment(x) [1] "this is the price of the R stock" > comment(x+4) [1] "this is the price of the R stock" [these are probably among the oldest R (non-S) functions, maybe not known for this reason, and not really used in other public functions AFAIK] Martin Maechler AustinM> -----Original Message----- AustinM> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Neil Leonard AustinM> Sent: Tuesday, August 24, 2004 22:0 PM AustinM> To: R-help at stat.math.ethz.ch AustinM> Subject: [R] Adding labels to variables AustinM> Hi, AustinM> Is it possible to add labels to variables in R (so AustinM> as to have a better description of what the AustinM> variables represent)?
> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Martin Maechler > Sent: Wednesday, August 25, 2004 2:46 AM > To: Austin, Matt > Cc: R-help at stat.math.ethz.ch > Subject: RE: [R] Adding labels to variables > > >>>>> "AustinM" == Austin, Matt <maustin at amgen.com> > >>>>> on Tue, 24 Aug 2004 22:15:15 -0700 writes: > > AustinM> Check out the Hmisc library. > > It's a *package*, not a library ! >[ ... rest deleted ...] As long as the function to load a package is called *library*, I think your campaign to change common usage is doomed to failure. Rich Raubertas
Sigh. I thought I was making a small innocuous observation, but it has apparently been taken as some kind of challenge. Martin's efforts to correct this usage seem (to me) frequent enough to justify calling the mistake 'common', but I guess others will disagree. And what grounds do you have for your implication that it is a mistake I make? Rich Raubertas> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Peter Dalgaard > Sent: Wednesday, August 25, 2004 4:37 PM > To: Mike Prager > Cc: R-help at stat.math.ethz.ch > Subject: Re: [R] Adding labels to variables > > > "Mike Prager" <Mike.Prager at noaa.gov> writes: > > > At 01:01 PM 08/25/2004, Raubertas, Richard wrote: > > >As long as the function to load a package is called *library*, > > >I think your campaign to change common usage is doomed to failure. > > Who says it's common usage? It is of course a common fallacy to think > that everyone else makes the same mistakes as you do... > > > Yes, and it's also annoyingly hard to remember -- at least for those > > of us who don't eat, sleep, and breathe R. > > There's a good chance that R-2.x will introduce usePackage() and > eventually remove library() as a tool for loading packages. > > -- > O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: > (+45) 35327918 > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: > (+45) 35327907 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >