Data Tabulation

Yangyong Ye

Why do we need tables?

  • count

  • summarize

  • intermediary

  • irreplaceable on something

When tables are better than graphs

  • preciseness

  • comprehensive (less form, more content)

用于生成表格的package

对表格进行美化的package

单个变量描述

  • jsmisc::frq() & sjmisc::descr()

  • rstatix::freq_table() & rstatix::get_summary_stats()

多个变量的并行描述

  • datasummary
  • datasummary_skim
  • datasummary_balance
  • datasummary_correlation
  • datasummary_crosstab

回归表格的生成

  • modelsummary::modelsummary()

  • gtsummary::tbl_regression()

表格设计flextable

表格设计flextable

flextable cheat sheet

表格设计kableExtra

  • table styles
  • column specification
  • row specification
  • cell/text specification
  • grouped columns / rows
  • table footnote

表格设计DT

Practice

  • 做一个频数表,性别,户口,家庭经济条件

  • 做一个交叉表,恋爱与否与家庭经济条件

  • 做一个统计表,身高,体重

NEXT WEEK reading materials

Package installation for Next week

  • gcookbook, ggridges, ggrepel, ggthemes

  • viridis, RColorBrewer, colorspace

  • gganimate, patchwork.