[Rd] row.names, rownames; colnames, no col.names?

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
12 Dec 2000 00:35:12 +0100


rossini@blindglobe.net (A.J. Rossini) writes:

> There's a bit of a symmetry issue, which may or may not be important
> (led to 15 seconds of confusion until I got my bearings straight): 
> 
> row.names, rownames; colnames, no col.names? 
> 
> I _NOW_ realize the difference between row.names and rownames, but
> is there any reason not to have col.names for re-naming columns in a
> data.frame? 
> 
> (if there is, I don't particular need to know it, but it might make a
> nice FAQ).

Well, plain names()<- will do fine, colnames()<- will as well. Data
frames have an attribute called "row.names", and hence it makes sense
to have an extractor function of the same name, but there is no
"col.names" attribute. (However, why we chose to have "rownames" and
"colnames" without dots escapes me for the moments. They go back to
before we had the data frame code, and I suspect it is mostly a
historical accident.) 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._