Skip to content

Instantly share code, notes, and snippets.

@vladiim
Created May 23, 2016 06:50
Show Gist options
  • Select an option

  • Save vladiim/52d3dfca73c550031ecbdf6192ca3ae4 to your computer and use it in GitHub Desktop.

Select an option

Save vladiim/52d3dfca73c550031ecbdf6192ca3ae4 to your computer and use it in GitHub Desktop.
require(lambda.tools)
chunk <- c('Garpolu', 'Grand Cape', 'blah Mount')
# List of c(replace_pattern, replace_with)
xforms <- list(c('Garpolu', 'Gbarpolu'), c('Grand Cape$', 'Grand Cape Mount'), c('ˆMount$', ''))
fold(xforms, function(r,ch) sub(r[1],r[2],ch), chunk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment