Depending on what exactly you are trying to accomplish: > as.numeric(unlist(strsplit(a, ","))) [1] 1 2
> read.csv(textConnection(a), header=FALSE) V1 V2 1 1 2 Sarah On Thu, Oct 18, 2012 at 9:08 AM, BenM <[email protected]> wrote: > Hi All, > Thanks in advance for your help. I'm trying to convert a string to an > integer vector. For instance, I will start with > > a <- "1,2" > > The result I want to end up with will be the equivalent of > > c(1,2) > > What's the best way to make the conversion? I've tried using as.integer(a), > but R seems to balk at that. > > Thanks, > > Ben -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ [email protected] 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.

