Try this:
library(gsubfn)
strapply(x, "\\d+", as.numeric, simplify = rbind)
On Thu, May 12, 2011 at 3:06 PM, Alon Honig wrote:
> I have a vector with a long list of sentences that contain integers. I
> would like to extract the integers in a manner such that they are
> separate and manipulatable
I have a vector with a long list of sentences that contain integers. I
would like to extract the integers in a manner such that they are
separate and manipulatable. for example:
x[i] <- "sally has 20 dollars in her pocket and 3 marbles"
x[i+1] <- "30 days ago john had a 400k house"
all sentences
2 matches
Mail list logo