[R] text matching and substitution

Stephan Kolassa Stephan.Kolassa at gmx.de
Sat Mar 28 10:45:22 CET 2009


Hi Simeon,

?gsub

HTH,
Stephan

simeon duckworth schrieb:
> I am trying to simplify a text variable by matching and replacing it with a
> string in another vector
> 
> so for example in
> colours <- paste(letters,colours(),"stuff",LETTERS)
> 
> find and replace with ("red","blue","green","gray","yellow","other")  -
> irrespective of case
> 
> its a large dataset, so i'd like to be able to do this as efficiently as
> possible.
> 
> thanks for any help
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list