Gabor Grothendieck <ggrothendieck <at> gmail.com> writes: > > We could use sapply to reduce it slightly: > > result <- sapply(sprintf("\\%d", 1:2), sub, pattern = pat, x = patid) > result[regexpr(pat, patid) < 0,] <- NA > Looks like we should make a generalized wrapper for it. Dieter