I use the expss package to produce summary tables of the mtcar data.
library(expss)
data(mtcars)
mtcars %>%
tab_cells(cyl) %>%
tab_cols(total(), vs) %>%
tab_rows(am) %>%
tab_stat_cpct(total_row_position = "above",
total_label = c("number of cases", "row %"),
total_statistic = c("u_cases", "u_rpct")) %>%
tab_pivot()
Now I would like to save the output in a html, pdf or jpeg file. Unfortunately encooperating save.image before or within the loop does not work. There must be an easy solution to this? I also tried to export from the viewer somehow and failed as well.
Further is there a possibility to display the number of cases of the factor (i.e. cylinders) per different engine and its overall proportion in one row (e.g. n case (xy%) ?)
To save table as html you can add
htmlTable
function at the end of your sequence and then save HTML code:You can produce cases and table percent in one row with the following code:
By now there is no option to put statistics in brackets in the same cell.