[R] convert delimited strings with ranges to numeric

Chris Stubben stubben at lanl.gov
Wed Aug 14 19:41:42 CEST 2013


Is there an easy way to convert character strings with comma-separated 
numbers and ranges to a numeric vector?

x<-  "2,5-7,10,12-15"

[1]  2  5  6  7 10 12 13 14 15

Thanks,
Chris


-- 

Chris Stubben

Los Alamos National Lab
Bioscience Division
MS M888
Los Alamos, NM 87545



More information about the R-help mailing list