Re: [R] extract integers from string

2011-05-12 Thread Henrique Dallazuanna
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

[R] extract integers from string

2011-05-12 Thread Alon Honig
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