[R] Prefix for colnames
murdoch at stats.uwo.ca
Wed Jul 20 16:03:20 CEST 2005
On 7/20/2005 9:54 AM, jhainm at fas.harvard.edu wrote:
> 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?
The prefix argument is only used when there are no names and colnames is
generating some. You just want to use paste().
> colnames(X) <- paste("PREFIX.", colnames(X), sep="")
PREFIX.test PREFIX.test PREFIX.test PREFIX.test
[1,] NA NA NA NA
[2,] NA NA NA NA
[3,] NA NA NA NA
More information about the R-help