[R] Don't understand write.csv default: Why is column name forcolumn of row names blank?

Earl F. Glynn efg at stowers-institute.org
Thu Nov 1 16:11:13 CET 2007


"Gabor Grothendieck" <ggrothendieck at gmail.com> wrote in message 
news:971536df0710311635w6f4c9979yf15a70f36e6babbc at mail.gmail.com...
> Would this be good enough:
>
> # example using builtin BOD data frame
> write.csv(cbind(Z = row.names(BOD), BOD), row.names = FALSE)

Thanks, Gabor,  I like your solution better than mine.

But, I still don't understand R's design and the lack of a column name for 
the row names. In R all database tables represented by a data.frame have a 
blank key name.  This missing column name is the database "key".  Having a 
mnemonic, non-blank, name for this "key"  would be an improvement IHMO.

I don't always have normalized data (in the database sense, 
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=104, 
"Database Normalization") but R's lack of a key name makes keeping track of 
data more difficult, and makes communication about any database 
normalization more difficult.  If one is using a database schema for 
selecting data, and paying careful attention to the keys, the key names are 
simply lost while in R.  Why?

I'm trying to politely challenge the design of R's current default behavior. 
Now we've got to do extra work to communicate necessary information, which 
doesn't make sense to me.  The default behavior should be to communicate 
necessary information -- the key name --  instead of hiding it

efg



More information about the R-help mailing list