On Jan 21, 2012, at 23:04 , Sarah Goslee wrote:

> + is a metacharacter, and must be escaped:
> 
>> X <- "one + two"
>> gsub("\\+", "plus", X)
> [1] "one plus two"
> 
> The help for gsub() tells you to read ?regexp - that's where
> the details of regular expressions as implemented in R are
> explained.
> 

...and it also tells you about the 'fixed' argument:

> X <- "one + two"
> gsub("+", "plus", X, fixed=TRUE)
[1] "one plus two"

-pd
-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to