I am working with R HMM package. I have a file with symbols on each line. I need to create 2D vector from this file, where i-th vector contains symbols from i-th line
I wrote code likes:
q4 = readLines("someFile")
c1 <- strsplit(q4[1],"")[[1]]
c2 <- strsplit(q4[2],"")[[1]]
c3 <- strsplit(q4[3],"")[[1]]
baumWelch(hmm, c(c1,c2,c3), 10)
and it works. But I have 50000 lines, so I need to do it in loop. So I wrote this one:
q4 = readLines("someFile")
results <- vector(length=length(q4))
for (i in 1:length(q4)) {
results[i] <- strsplit(q4[i],"")[[1]]
}
baumWelch(hmm, results, 10)
But each vectors contained only first symbol from the line. So I removed
[[1]]
from code, but type of results was list and not vector so I can not use it. How can I do it correctly?