Re: [R] subbing a string vector for another string vector
One way to do it is with mapply: mydf = data.frame(image=c('http://$IMAGE_ID$','$IMAGE_ID$'),pattern=c('www.url.com/image.jpg','http://www.blah.com/image.gif')) mydf$url = mapply(sub,"\\$IMAGE_ID\\$",mydf$pattern,mydf$image) mydf image pattern
Re: [R] subbing a string vector for another string vector
On Sep 8, 2010, at 4:45 PM, jlemaitre wrote: I have a data frame with two columns: url.img patt.url 1http://$IMAGE_ID$www.url.com/image.jpg 2$IMAGE_ID$ http://www.blah.com/image.gif ... I want to replace "$IMAGE_ID$"