Skip to content

Instantly share code, notes, and snippets.

@tgjc
Created August 17, 2016 04:46
Show Gist options
  • Select an option

  • Save tgjc/3f62450ae0f7e54e115eb26a93a05fb3 to your computer and use it in GitHub Desktop.

Select an option

Save tgjc/3f62450ae0f7e54e115eb26a93a05fb3 to your computer and use it in GitHub Desktop.
R dplyr: rename variables using string functions
DATA %>% rename_(.dots=setNames(names(.), tolower(gsub("FROM", "TO", names(.)))))
## Taken from: http://stackoverflow.com/questions/30382908/r-dplyr-rename-variables-using-string-functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment