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). best, -tony -- A.J. Rossini Rsrch. Asst. Prof. of Biostatistics BlindGlobe Networks (home/default) rossini@blindglobe.net UW Biostat/Center for AIDS Research rossini@u.washington.edu FHCRC/SCHARP/HIV Vaccine Trials Net rossini@scharp.org FHCRC: M/Tu: 206-667-7025 (fax=4812) | Voicemail is pretty sketchy CFAR: W/F: 206-731-3647 (fax=3694) | Email is far better than phone UW: Th/F: 206-543-1044 (fax=3286) | Change last 4 digits of phone for fax -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> 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).Re col.names, certainly not for 1.2.0. I am personally not a big fan of advertising row.names, as I think it is too close to the rownames of the matrix interpretation of data frames. This is why R has abstract functions case.names() and variable.names(), which would be my preference. -k -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2000-Dec-11 23:35 UTC
[Rd] row.names, rownames; colnames, no col.names?
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._