[R] attributes of a data.frame

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Nov 23 15:20:23 CET 2005


Why do you have names like 'pctx723' in the first place?

I have never had a difficulty with using informative column names whereas 
you seem to require the extra complication of `variable labels'.
Now we have `` and allow _ in syntactic names it is even easier than it 
was.

On Tue, 22 Nov 2005, Michael Friendly wrote:

> It's hard for me to resist dipping my oar into this...
>
> Variable labels are so generally useful, both in documenting a
> dataset (what was 'pctx723' again?) and in producing readable
> output and graphs that it is a shame they are not provided in
> base R.  If they were (and were used in print and plot methods,
> when available) it would avoid a lot of the necessity to specify
> xlab= and ylab= in graphs, or, perhaps worse, ending up with
> pctx723 as the label in your presentation.
>
> -Michael
>
>> On 11/21/2005 2:51 PM, Adrian DUSA wrote:
>>
>>>> On Monday 21 November 2005 22:41, Duncan Murdoch wrote:
>>>
>>>>>> [...snip...]
>>>>>> Not all dataframes have the variable.labels attribute.  I'm guessing
>>>>>> you've installed some contributed package to add them, or are importing
>>>>>> an SPSS datafile using read.spss.  So don't expect varlab() or
>>>>>> variable.labels() function to be a standard R function.
>>>
>>>>
>>>> Aa-haa... of course you are right: I read them via read.spss. I understand.
>>>> Now, just to the sake of it, would it be wrong to make it standard?
>>>> Is there a special reason not to?
>>
>>
>> I think it's just that the R core developers don't see the need for
>> them.  If something is worth documenting, then you should write an .Rd
>> file or a vignette about it, and that gives you more flexibility than a
>> one line label.
>>
>> I think there are definitely developers out there who disagree with this
>> point of view, and I'm pretty sure I've seen a contributed package that
>> offered support for this, but I can't remember which one right now.  So
>> that's another reason why it's not in the base:  it doesn't need to be,
>> you can just go find and install that contributed package!


-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list