课题组每周研讨会
内容:
read.*
与 write.*
load
与 save
readRDS
与 saveRDS
https://github.com/tidyverse/
数据导入 read_*
管道 %>%
x %>% f(y)
> f(x, y)
筛选
slice
, filter
, sample_n
, sample_frac
, top_n
, distinct
select
contains
num_range
starts_with
ends_with
one_of
matches
arrange
行列增加/更新
mutate
, transmute
mutate_
add_row
add_column
rename
rownames_to_column
, column_to_rowname
+ - * / > < ==
dplyr::
lag
lead
dplyr::
cumall
cumany
cummax
cummean
cummin
cumprod
cumsum
dplyr::
cume_dist
dense_rank
min_rank
ntile
percent_rank
row_number
dplyr::
between
case_when
coalesce
if_else
na_if
pmax
pmin
recode
recode_factor
汇总
count
summarize
group_by
, ungroup
dplyr::
n
n_distinct
base::sum(!is.na())
mean
, meadian
mean
, sum
dplyr::
first
last
nth
quantile
min
max
IQR
mad
sd
var
合并
bind_rows
bind_cols
semi_join
anti_join
left_join
, right_join
, inner_join
, full_join
intersect
setdiff
union
setequal
辅助查看两个数据集是否相同(不管行序)变异动词 (_at
, _if
, _all
)
filter_*
select_*
summarize_*
arrange_*
字符处理
substr
stringr
包与正则表达式略微复杂,可以单独讲一次Tidy 数据格式
tibble
tribble
, enframe
as_tibble
, is_tibble
drop_na
fill
replace_na
长转宽 pivot_wider
, spread
宽转长 pivot_longer
, gather
expand
complete
separate
separate_rows
unite
数据导出
write_*
fread
fwrite
dt[i, j, by]
base
与 stringr
purrr
stats
与 broom
graphics
与 ggplot2
apply
家族和purrr
等开发: