[R] Prefix for colnames

jhainm@fas.harvard.edu jhainm at fas.harvard.edu
Wed Jul 20 15:54:04 CEST 2005


Hi,

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!

Best,
Jens




More information about the R-help mailing list