[R] String to array

Ben Bolker bbolker at gmail.com
Thu Dec 9 15:34:03 CET 2010


Romildo Martins <romildo.martins <at> gmail.com> writes:


> how convert x in xarray (numbers)?
> 
> > x
> [1] "0 - 13"
> > y
> [1] "11 - 23"
> > z
> [1] "220 - 9"
> > xarray
> [1]  0 13
> > yarray
> [1] 11 23
> > zarray
> [1] 220   9

  Is

as.numeric(unlist(strsplit("0 - 13","-")))

  what you want?



More information about the R-help mailing list