This is a test version of Biostars. For the public version, visit https://www.biostars.org.
making a factor numeric

Hi,

I have a file contains gene name and length, like below

> genes <- as.data.frame(read.csv("geneID and length.txt",header = FALSE, sep=","),stringsAsFactors=FALSE)
> head(genes[1:2])
       V1          V2
1 genesID geneslength
2  R0010W        1272
3  R0020C        1122
4  R0030W         546
5  R0040C         891
6 YAL069W         315

> genesID <- genes[,1]
> geneslength <- genes[,2]

I used ncol=(as.integer(max(geneslength))) but error:

Error in Summary.factor(c(1368L, 115L, 53L, 1135L, 1317L, 776L, 593L,  : 
  'max' not meaningful for factors

How I can make geneslength numeric please?

Thank you

r

0 answers

No answers yet.

Log in to answer this question.