> "IC" == Ivan Calandra
> on Mon, 27 Sep 2010 16:59:31 +0200 writes:
IC> Hi,
IC> I'm not sure it's even possible (and if it is I don't know how, but I'm
IC> no expert).
yes it is possible (in some way), see below.
IC> But I think it doesn't make much sense to have o
Hi,
I'm not sure it's even possible (and if it is I don't know how, but I'm
no expert).
But I think it doesn't make much sense to have only one named column.
Just give it a vector:
vect_names <- c("myname1", "myname2", "myname3")
colnames(my_matrix) <- vect_names
HTH,
Ivan
Le 9/27/2010 10:
-project.org
Subject: [R] name ONLY one column
Hi R-users
I can not change the name of one column only of my matrix.
my_matrix <- matrix (1:12,ncol=3)
colnames(my_matrix)[1] <- 'myname'
Error in dimnames(x) <- dn :
length of 'dimnames' [2] not equal to array
Hi Lorenzo,
The problem is that my_matrix does not have dimnames. See below.
my_matrix <- matrix (1:12,ncol=3)
str(my_matrix) ## does not have dimnames
dimnames(my_matrix) ## dimnames is NULL
colnames(my_matrix) <- "myname" # fails because you are trying to
alter the value of something that does
Hi R-users
I can not change the name of one column only of my matrix.
my_matrix <- matrix (1:12,ncol=3)
colnames(my_matrix)[1] <- 'myname'
Error in dimnames(x) <- dn :
length of 'dimnames' [2] not equal to array extent
thank you for your help
Lorenzo
[[alternat
5 matches
Mail list logo