Skip to content
Prev 167299 / 398502 Next

splitting a string / finding a numeric value within a string

The first one replaces non-numerics with the empty string
and the second one returns numerics directly:

gsub("[^0-9]", "", "test_01.log")

# or
library(gsubfn)
strapply("test_01.log", "[0-9]+")[[1]]
On Fri, Jan 16, 2009 at 11:00 PM, J?rg Gro? <joerg at licht-malerei.de> wrote: