strsplit
returns a list. In this case, it is a list of length 1, but if you used readLines
on the whole file, then called strsplit
, it would return a list of the same length as the number of lines.
For the way you're using it, you need to select the first element of the first component of the list. i.e. myVector[[1]][1]
for "u" and myVector[[1]][2]
for "rtu". Also, in this case, unlist(myVector)[1]
and unlist(myVector)[2]
would work.