首页 > 解决方案 > expss 打包成 Markdown PDF

问题描述

我似乎无法让以下代码块在 PDF markdown 中工作,它只能在 HTML 中工作。我尝试通过tinytex重新安装乳胶,但仍然没有任何效果。这里我得到以下错误: 错误:ncol(obj1) is not NULL or ncol(obj2) is not NULL or ncol(obj1) not equal to ncol(obj2)

这是有问题的代码块,因为没有它,文档就会编织。感谢您提供的任何见解。

SPSST %>% 
  tab_cells(edu.RC, race.RC, relig.RC, age.RC) %>% #rows
  tab_cols(total(), income.RC) %>% #columns
  tab_weight(popwght) %>% #weights
  tab_stat_rpct() %>% #column percents
  tab_pivot() %>% #make pivot table (think excel)
  set_caption("Cross Tables of Recoded Variables (WEIGHTED)")

标签: rr-markdownexpss

解决方案


The best solution is to pass the expss results to kable. Add the following commands to your script and it should render into PDF via Rmarkdown.

library(kableExtra)

... 
split_table_to_df() %>%
kable() %>% kable_styling()

推荐阅读