Re: [R] From string to numeric

2010-09-15 Thread Jorge Ivan Velez
Hi Cristofer, Try as.numeric(strsplit(x, ",")[[1]]) HTH, Jorge On Wed, Sep 15, 2010 at 4:42 PM, Christofer Bogaso <> wrote: > Hi, I have a string like "1,2,5,7,8". > > From this I want to create a numeric vector of length 5 (total number > of numbers in above string), with each element will b

Re: [R] From string to numeric

2010-09-15 Thread Greg Snow
lto:r-help-boun...@r- > project.org] On Behalf Of Christofer Bogaso > Sent: Wednesday, September 15, 2010 2:42 PM > To: r-help > Subject: [R] From string to numeric > > Hi, I have a string like "1,2,5,7,8". > > From this I want to create a numeric vector of length

Re: [R] From string to numeric

2010-09-15 Thread Henrique Dallazuanna
Try this: x <- scan(textConnection("1,2,5,7,8"), sep = ",") On Wed, Sep 15, 2010 at 5:42 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hi, I have a string like "1,2,5,7,8". > > From this I want to create a numeric vector of length 5 (total number > of numbers in above string), wi

[R] From string to numeric

2010-09-15 Thread Christofer Bogaso
Hi, I have a string like "1,2,5,7,8". >From this I want to create a numeric vector of length 5 (total number of numbers in above string), with each element will be the number in above string. Is there any possibility to doing this? Thanks and regards,