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
> x <- "1,2,5,7,8"
> as.numeric(unlist(strsplit(x, ',')))
[1] 1 2 5 7 8
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On
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
3 matches
Mail list logo