Re: [Rd] strcapture enhancement

2016-09-21 Thread Michael Lawrence
Thanks for the suggestion. Checked in that change. Michael On Wed, Sep 21, 2016 at 11:06 AM, William Dunlap via R-devel wrote: > The new strcapture function in R-devel is handy, capturing > the matches to the parenthesized subpatterns in a regular > expression in the columns of a data.frame, who

Re: [Rd] strcapture enhancement

2016-09-21 Thread Gabor Grothendieck
Note that read.pattern in gsubfn does accept stringsAsFactors = FALSE, e.g. using your input lines and pattern: library(gsubfn) Lines <- c("Three 3", "Twenty 20") pat <- "([[:alpha:]]*) +([[:digit:]]*)" s2 <- read.pattern(text = Lines, pattern = pat, stringsAsFactors = FALSE, col.names = c("Name

[Rd] strcapture enhancement

2016-09-21 Thread William Dunlap via R-devel
The new strcapture function in R-devel is handy, capturing the matches to the parenthesized subpatterns in a regular expression in the columns of a data.frame, whose column names and classes are given by the 'proto' argument. E.g., > p1 <- data.frame(Name="", Number=0) > str(strcapture("([[:alpha