Janitor
Package description
library(janitor)
library(readxl)
library(dplyr)
0.1 clean_names
Resulting names of data.frame are unique and consist only of the _ character, lowercase letters, and numbers.
# Create a data.frame with dirty names
test_df <- as.data.frame(matrix(ncol = 6))
names(test_df) <- c("hIgHlo", "REPEAT VALUE", "REPEAT VALUE",
"% successful (2009)", "abc@!*", "")
glimpse(test_df)
## Observations: 1
## Variables: 6
## $ hIgHlo <lgl> NA
## $ REPEAT VALUE <lgl> NA
## $ REPEAT VALUE <lgl> NA
## $ % successful (2009) <lgl> NA
## $ abc@!* <lgl> NA
## $ <lgl> NA
test_df %>%
clean_names()
## highlo repeat_value repeat_value_2 percent_successful_2009 abc x
## 1 NA NA NA NA NA NA