[R] gsub patterns from vector elements w/out loop?
Marianne Promberger
marianne.promberger at kcl.ac.uk
Mon Feb 22 17:55:45 CET 2010
> > gsub(paste(x, collapse = "|"), "something else", y)
> [1] "something else blah" "something else blah" "something else blah"
> [4] "something else blah"
Many thanks! I didn't know about "collapse". Should have thought about
reading up in ?paste ...
Thanks
Marianne
--
Marianne Promberger PhD, King's College London
http://promberger.info
R version 2.10.1 (2009-12-14)
Ubuntu 9.10
More information about the R-help
mailing list