[R] Error in "rownames"

David Winsemius dwinsemius at comcast.net
Wed Jul 22 18:22:02 CEST 2015


On Jul 22, 2015, at 12:50 AM, JIALU YAO wrote:

> Hello,
> 
> When I type the code *rownames(gene_exp_matrix)<-levels(geneidfactor)*,the
> error happens: Error in "rownames<-(*tmp*,value=character(0)):can not set
> object to 'rownames'.
> 
> I am using Mac OS X10.10.2.
> 
> How can I fix this problem?
> 

The error suggests that levels(geneidfactor) is returning a vector of length 0.

How do you fix that? The first thing I would do is check to see if spelling might be an issue and then see what str(geneidfactor) returns. If this process makes any sense (noting that the order of a dataframe factor variable might not be the same as the level-names), then my guess is that you failed to include the dataframe name where the factor vector resides.
> 

-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list