Skip to content
Prev 175272 / 398506 Next

text matching and substitution

Hi Simeon,

I played around a little with Vectorize and mapply, but I couldn't make 
it work :-( So, my best guess would be a simple loop like this:

result <- as.character(paste(letters,colours(),"stuff",LETTERS))
target <- c("red","blue","green","gray")
for ( new.color in target ) { result[grep(new.color,result)] <- new.color }

Best of luck,
Stephan


simeon duckworth schrieb: