Skip to content
Prev 200649 / 398503 Next

parsing numeric values

A minor variant might be the following:

   library(gsubfn)
   strapply(input, "\\d+\\.\\d+E[-+]?\\d+", as.numeric, simplify = rbind)

where:

- as.numeric is used in place of c in which case we do not need combine
- \\d+ matches one or more digits
- \\. matches a decimal point
- [-+]? matches -, + or nothing (i.e. an optional sign).
- parentheses around the regular expression not needed
On Wed, Nov 18, 2009 at 7:28 AM, Henrique Dallazuanna <wwwhsd at gmail.com> wrote: