[R] column names in matrix vs. data frame in R 1.8

White.Denis@epamail.epa.gov White.Denis at epamail.epa.gov
Tue Feb 17 17:31:33 CET 2004


> > Ok, I'll regard it as an inconsistency that the conversion of
> > to data frame column names changes reserved words to legitimate
> > but direct assignment doesn't.
> It's not inconsistent.  data.frame has an argument `check.names' to
> control the behaviour on *creating* a data frame, and you didn't
> the documentation.  Using the function names<- on the list underlying
> data frame does not know or care it is applied to a data frame.

After thinking about this, I guess I wonder why names<- shouldn't have
the argument 'check.names' and/or check the class of its main argument.
Why offer protection in one situation and not another?

More information about the R-help mailing list