[R] ROWNAMES error message

Sean Davis sdavis2 at mail.nih.gov
Tue Mar 21 20:53:14 CET 2006




On 3/21/06 2:26 PM, "mark salsburg" <mark.salsburg at gmail.com> wrote:

> I am getting an error message, which I do not know the source to.
> 
> I have a matrix SAMPLES that has preexisting rownames that I would like to
> change.
> GENE_NAMES contains these rownames.
> 
> 
>> rownames(SAMPLES) = GENE_NAMES
> Error in "dimnames<-.data.frame"(`*tmp*`, value = list(list(V1 = c(3843,  :
>         invalid 'dimnames' given for data frame
>> dim(SAMPLES)
> [1] 12626    20
>> dim(GENE_NAMES)
> [1] 12626     1
>> is.data.frame(SAMPLES)
> [1] TRUE
>> is.data.frame(GENE_NAMES)
> [1] TRUE
> 
> I have tried converting GENE_NAMES to a factor, R will not allow me because
> its says "x must be atomic"
> 
> ANY IDEAS??

 rownames() is looking for a vector.  You are asking it to assign a
data.frame.  Try 

 rownames(SAMPLES) <- GENE_NAMES[,1]

Sean




More information about the R-help mailing list