[R] character to numeric conversion

2007-03-19 Thread Robin Hankin
Hi. Is there a straightforward way to convert a character string containing comma-delimited numbers to a numeric vector? In my application, I use system(executable.string, intern=TRUE) which returns a string like "[0.E-38, 2.096751179214927596171268230, 3.678944959657480671183123052, 4.97

Re: [R] character to numeric conversion

2007-03-19 Thread Dimitris Rizopoulos
http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "Robin Hankin" <[EMAIL PROTECTED]> To: "RHelp help" Sent: Monday, March 19, 2007 10:18 AM Subject: [R] character to numeric conversion > Hi. > > Is there a s

Re: [R] character to numeric conversion

2007-03-19 Thread Peter Dalgaard
Robin Hankin wrote: > Hi. > > Is there a straightforward way to convert a character string > containing comma-delimited > numbers to a numeric vector? > > In my application, I use > > system(executable.string, intern=TRUE) > > which returns a string like > > "[0.E-38, 2.0967511792149275961712682

Re: [R] character to numeric conversion

2007-03-19 Thread Robin Hankin
Hello everybody thanks for the tips. I *think* this should be the same thread The manpage for system() says that lines of over 8095 characters will be split. This is causing me problems. How do I get round the 8095 character limit? Simple toy example follows: jj <- system("echo 4 | aw

Re: [R] character to numeric conversion

2007-03-19 Thread Robin Hankin
On 19 Mar 2007, at 11:20, Robin Hankin wrote: > Hello everybody > > thanks for the tips. > > I *think* this should be the same thread > > > The manpage for system() says that lines of over 8095 > characters will be split. This is causing me problems. > How do I get round the 8095 character l

Re: [R] character to numeric conversion

2007-03-19 Thread Roger Bivand
On Mon, 19 Mar 2007, Robin Hankin wrote: > Hello everybody > > thanks for the tips. > > I *think* this should be the same thread > > > The manpage for system() says that lines of over 8095 > characters will be split. This is causing me problems. > How do I get round the 8095 character lim

Re: [R] character to numeric conversion

2007-03-19 Thread Gabor Grothendieck
Here is one way. This matches strings which contain those characters found in a number, converting each such string to numeric. library(gsubfn) strapply(x, "[-0-9+.E]+", as.numeric) On 3/19/07, Robin Hankin <[EMAIL PROTECTED]> wrote: > Hi. > > Is there a straightforward way to convert a charact

Re: [R] character to numeric conversion

2007-03-19 Thread Greg Snow
Sent: Monday, March 19, 2007 5:20 AM > To: Peter Dalgaard > Cc: RHelp help; Robin Hankin > Subject: Re: [R] character to numeric conversion > > Hello everybody > > thanks for the tips. > > I *think* this should be the same thread > > > The manpage for syste