[R] converting a string to an integer vector

jeff6868 geoffrey_klein at etu.u-bourgogne.fr
Thu Oct 18 16:06:01 CEST 2012


Hello,

Try this, It'll maybe help you:

a <- "1,2" 
b <- strsplit(a,",")   #split your data according to ","
b <- unlist(b)  # it creates a list, so we unlist the result to obtain a
vector like c(1,2)





--
View this message in context: http://r.789695.n4.nabble.com/converting-a-string-to-an-integer-vector-tp4646610p4646619.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list