[R] Oddity with names

Andrew Robinson andrewr at uidaho.edu
Thu Jul 18 07:03:05 CEST 2002


Hi all,

I'm using R 1.5.1 on Windows 2000.  The following snippet of code doesn't 
seem to do anything - no error is reported, and there is no name change.

names(myFrame[,c(1:3)]) <- c("name1", "name2", "name3")

This code however works nicely:

names(myFrame)[c(1:3)] <- c("name1", "name2", "name3")

Can anyone suggest why the first doesn't work?  Ought an error be reported?

Thanks,

Andrew

Andrew Robinson                  Phone: 208-885-7115
Department of Forest Resources   Fax:   208-885-6226
University of Idaho              E: andrewr at uidaho.edu
Po Box 441133                    WWW: http://www.uidaho.edu/~andrewr
Moscow, ID 83843                 and: http://www.biometrics.uidaho.edu/
No statement above may be construed to necessarily represent my employer.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list