1

I cant seem to get the following code chunk to work in PDF markdown, it only works in HTML. I tried re-installing latex through tinytex, but still nothing is working. Here the following error I get: Error: ncol(obj1) is not NULL or ncol(obj2) is not NULL or ncol(obj1) not equal to ncol(obj2)

This is the code chunk in question, because without this, the document knits. Thank you for any insight you might give.

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)")

1 Answers1

1

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()
Ben
  • 1,113
  • 10
  • 26