Hi,

I have a line such as:

myline <-  "    0.100000      1.5000      0.6000                 538
 0.369404"

and I would like to put the numbers into a vector. Some combination of
tabs and spaces occur between the numbers.

I tried:

try1 <- strsplit(myline,"[[:blank:]]+")
> try1
[[1]]
[1] ""         "0.100000" "1.5000"   "0.6000"   "538"      "0.369404"

The first element is "", which I do not want. I can get rid of the
"", but I was wondering if someone can show me the proper way to do
this in 1 line.

Thanks,

Juliet

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to