janitor学习
#devtools::install_github("sfirke/janitor") #http://sfirke.github.io/janitor/articles/janitor.html library(janitor) test_df <- as.data.frame(matrix(ncol = 6)) names(test_df) <- c("firstName", "ábc@!*", "% successful (2009)", "REPEAT VALUE", "REPEAT VALUE", "") #变量名清理 test_df %>% clean_names() #列联表 mtcars %>% tabyl(gear, cyl) %>% adorn_totals(where = c('row','col')) %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 2) %>% adorn_ns() %>% adorn_title() #获得重复值 get_dupes(mtcars, wt, cyl) #缺失行列删除 q <- data.frame(v1 = c(1, NA, 3), v2 = c(NA, NA, NA), v3 = c("a", NA, "b")) q %>% remove_empty(c("rows", "...