Skip to content
Prev 6061 / 63468 Next

Variable lables (was Re: [R] Reading SAS version 8 data into

Dear Greg,

I too would like to see labels be more a part of R.
In Hmisc I allow labels to be any length but plotting
and table making functions have options to abbreviate()
them or use variable names instead of labels.

I think your code is more complex that is really needed.

The problem with defaulting to deparse(...) is that
multiple function pass-throughs return the wrong result:
[1] "z"

So I don't see a large role for the deparse(...) method.

The Hmisc library already defines label<- so if you
are willing to use another name for your version that
would prevent confusion from users of Hmisc.

The problem of labels being retained after you do
arithmetic on the variable is a real one, and one
I've put up with for a long time with S-Plus.  It would
be nice if R could prevent that but that is getting tricky.
What I've wanted more generally is the ability for the
user to specify a vector of attribute names in options()
that would be preserved upon subsetting.  That way I
wouldn't have to go to trouble to write local versions
of [.factor, etc. that carry the 'label' attribute.
Im my usage, 'label's are always logically carried
forward for subsetting.

Frank
"Warnes, Gregory R" wrote: