Entering edit mode
after converting raw counts to cpm from data file using command
lcpm<-cpm(y, log=T) head(lcpm)
gives first row with unique numeric ID which denotes gene names from data file. How to export name of genes into *.csv file but with name of genes ?
write.csv(highly_variable_lcpm, row.names=y2$genes, file = "highly_variable_lcpm_genes.csv")
I get error message as below
Error in write.table(highly_variable_lcpm, row.names = y2$genes, file = "highly_variable_lcpm_genes.csv", : invalid 'row.names' specification
How to solve the problem ? THx
Sorry, still can't find the solution
Just give the character vector of gene names to
write.csv
. Presumably the gene names or symbols are stored as a column iny2$genes
, so just pull out the relevant column and use that asrow.names=
.I did it as you have said which I have in my first post.
If you in an interactive r session do your analysis and type y2$genes you will see that this is not a vector. You hence have to select one of the columns (= a vector) of this dataframe to use as row names.