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 ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.