storing long strings (DNA sequence) in R

后端 未结 2 1080
刺人心
刺人心 2020-12-21 02:11

I have written a function that finds the indices of subsequences in a long DNA sequence. It works when my longer DNA sequence is < about 4000 characters. However, when I

2条回答
  •  生来不讨喜
    2020-12-21 02:59

    I can replicate nrussell's example, but this assigns correctly x<-paste0(rep("abcdef",1000),collapse="") -- a potential workaround is writing the character string to a .txt file and reading the .txt file into R directly:

    test.txt is a 6,000 character long string.

    `test<-read.table('test.txt',stringsAsFactors = FALSE)
     length(class(test[1,1]))
    [1] 1
    class(test[1,1])
    [1] "character"
     nchar(test[1,1])
    [1] 6000`
    

提交回复
热议问题