The R Project SVN R

Rev

Rev 69569 | Rev 80096 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 69569 Rev 75050
Line 80... Line 80...
80
## One idea is to "blank out" the parenthesized parts to match the
80
## One idea is to "blank out" the parenthesized parts to match the
81
## parts to be used for splitting, and extract the persons as the
81
## parts to be used for splitting, and extract the persons as the
82
## non-matched parts.
82
## non-matched parts.
83
## First, match the parenthesized hobby lists.
83
## First, match the parenthesized hobby lists.
84
m <- gregexpr("\\\\([^)]*\\\\)", x)
84
m <- gregexpr("\\\\([^)]*\\\\)", x)
85
## Write a little utility for creating blank strings with given numbers
85
## Create blank strings with given numbers of characters.
86
## of characters.
-
 
87
blanks <- function(n) strrep(" ", n)
86
blanks <- function(n) strrep(" ", n)
88
## Create a copy of x with the parenthesized parts blanked out.
87
## Create a copy of x with the parenthesized parts blanked out.
89
s <- x
88
s <- x
90
regmatches(s, m) <- Map(blanks, lapply(regmatches(s, m), nchar))
89
regmatches(s, m) <- Map(blanks, lapply(regmatches(s, m), nchar))
91
s
90
s