hi,
is there an easy way to extract numbers from a string?
for example I have;
this Item costs 3.32 Dollars
is there an easy way to extract the 3.32 as a number?
thanks!
__
R-help@r-project.org mailing list
Try this:
library(gsubfn)
s - this item costs 3.32 Dollars
strapply(s, [0-9][0-9.]*, as.numeric)[[1]]
See http://gsubfn.googlecode.com for more info.
On Wed, Aug 26, 2009 at 6:38 PM, Martin Batholdybatho...@googlemail.com wrote:
hi,
is there an easy way to extract numbers from a string?
Hi,
On Aug 26, 2009, at 6:38 PM, Martin Batholdy wrote:
hi,
is there an easy way to extract numbers from a string?
for example I have;
this Item costs 3.32 Dollars
is there an easy way to extract the 3.32 as a number?
Regular expressions to the rescue?
Perhaps you'll need to fine tune
[mailto:r-help-boun...@r-project.org] On
Behalf Of Steve Lianoglou
Sent: Wednesday, August 26, 2009 3:49 PM
To: Martin Batholdy
Cc: r-help@r-project.org
Subject: Re: [R] find numbers in a line with letters
Hi,
On Aug 26, 2009, at 6:38 PM, Martin Batholdy wrote:
hi,
is there an easy way to extract
4 matches
Mail list logo