Re: [R] Converting charter string to vector of numbers (Turgidson)

2015-03-26 Thread Manel Amado Martí
s(vectnum) ## see that is returning a list numaux<-as.numeric(vectnum[[1]])## get the nummerical vector form the vector object that stays into the vectnum list Message: 20 Date: Wed, 25 Mar 2015 10:27:40 -0700 (PDT) From: Turgidson To: r-help@r-project.org Subject: [R] Convertin

Re: [R] Converting charter string to vector of numbers

2015-03-25 Thread David Winsemius
On Mar 25, 2015, at 10:27 AM, Turgidson wrote: > Apologies for bringing up an old topic, but I am not finding working answers. > I am also an R newbie, so I'm still on the steep part of the learning curve. > > I have a character string : "0.5 1 2 3 4" > > I need to convert it to a vector of n

Re: [R] Converting charter string to vector of numbers

2015-03-25 Thread Jeff Newmiller
No, you don't need the commas. All data in R are vectors, and as.numeric handles vectors just fine. Keep in mind that what you see on the console is not necessarily what is in memory... the syntax you see or use to input data is just that... a tool for helping you communicate. For example, ther

[R] Converting charter string to vector of numbers

2015-03-25 Thread Turgidson
Apologies for bringing up an old topic, but I am not finding working answers. I am also an R newbie, so I'm still on the steep part of the learning curve. I have a character string : "0.5 1 2 3 4" I need to convert it to a vector of numbers. I get as far as strsplit(), which gives me "0.5"