filter()
slice()
arrange()
select()
summarize()
sum(x > 10) 和 mean(y == 0)
group_by()
dplyr::all_equal()
janitor::compare_df_cols()
vetr::alike()
diffdf::diffdf()
readr
readxl
pivot_longer()
pivot_wider()
separate()
untie()
unite()
chop()
unchop()
uncount()
map()
imap()
WDIsearch()
WDI
freq
descr()
clean_names
tabyl
get_dupes
remove_
round_half_up
excel_numeric_to_date
top_levels
row_to_names
after_join()
frq()
flat_table()
rec()
df <- data.frame(x = 1:3, y = c("a", "b", "c"))
df %>% keep(is.numeric) #> x #> 1 1 #> 2 2 #> 3 3
df %>% discard(is.numeric) #> y #> 1 a #> 2 b #> 3 c
df %>% mutate(new_col = LETTERS[1:3]) %>% detect(is.factor) #> [1] a b c #> Levels: a b c
df %>% detect_index(is.factor) #> [1] 2
df <- data.frame( num1 = c(0, 10, 20), num2 = c(5, 6, 7), chr1 = c("a", "b", "c"), stringsAsFactors = FALSE ) df %>% map_if(is.numeric, mean, na.rm = T) %>% str() #> List of 3 #> $ num1: num 10 #> $ num2: num 6 #> $ chr1: chr [1:3] "a" "b" "c"
df %>% modify_if(is.character, str_to_upper) %>% str() #> 'data.frame': 3 obs. of 3 variables: #> $ num1: num 0 10 20 #> $ num2: num 5 6 7 #> $ chr1: chr "A" "B" "C"