[R] attributes of a data.frame
Adrian DUSA
dusa.adrian at gmail.com
Mon Nov 21 20:18:54 CET 2005
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
More information about the R-help
mailing list