Skip to content

Instantly share code, notes, and snippets.

@apreshill
Created March 25, 2016 16:54
Show Gist options
  • Save apreshill/b22ea59a3fc7086b3acd to your computer and use it in GitHub Desktop.
Save apreshill/b22ea59a3fc7086b3acd to your computer and use it in GitHub Desktop.
# convert all column names to snake case
# make all column names lower case
# replace all . with _
names2snake <- function(data){
require(stringr)
require(dplyr)
names(data) = names(data) %>%
tolower() %>%
str_replace_all(., "[.]", "_")
data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment