[R] attributes of a data.frame

Berton Gunter gunter.berton at gene.com
Mon Nov 21 21:33:23 CET 2005


No! Ignore my previous "advice" .

To assign attrributes of anything, see ?attributes.

Shame on me!

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Adrian DUSA
> Sent: Monday, November 21, 2005 11:19 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] attributes of a data.frame
> 
> 
> Dear all,
> 
> I noticed that a data.frame has four attributes:
> - names
> - row.names
> - class
> - variable.labels
> 
> While one can use the first three (i.e. names(foo) or 
> class(foo)), the fourth 
> one can only be used via:
> attributes(foo)$variable.labels
> (which is kind of a tedious thing to type)
> 
> Is it or would be possible to simply use:
> variable.labels(foo)
> like the first three attributes?
> 
> I tried:
> varlab <- function(x) attributes(x)$variable.labels
> 
> but then I cannot use this to assign a specific label:
> > varlab(foo)[1] <- "some string"
> Error: couldn't find function "varlab<-"
> 
> Thank you,
> Adrian
> 
> -- 
> Adrian DUSA
> Romanian Social Data Archive
> 1, Schitu Magureanu Bd
> 050025 Bucharest sector 5
> Romania
> Tel./Fax: +40 21 3126618 \
>           +40 21 3120210 / int.101
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list