[R] attributes of a data.frame

Michael Friendly friendly at yorku.ca
Tue Nov 22 19:57:55 CET 2005


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!
> 

-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA




More information about the R-help mailing list