[R] Prefix for colnames

From: <jhainm_at_fas.harvard.edu>
Date: Wed 20 Jul 2005 - 23:54:04 EST


I would like to add a prefix to colnames in a matrix but I can't get the prefix option in colnames to work. What am I doing wrong?

> X<-matrix(NA,3,4)
> colnames(X)<-c("test","test","test","test")
> colnames(X)<-colnames(X,prefix="PREFIX.")

> X

     test test test test

[1,]   NA   NA   NA   NA
[2,]   NA   NA   NA   NA
[3,]   NA   NA   NA   NA

?? I also tried with do.NULL set to FALSE but it still does not work.

Thank you very much for your help!


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 21 00:02:13 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:51 EST