if (FALSE) {
# Excel export
m <- newMultitable(~ gender + age4 + marstat, data = ds)
tabBook(m, ds, format = "xlsx", file = "wealthy-tab-book.xlsx", filter = "wealthy")
# csv export
tabBook(
m,
ds[c("q5a", "q8", "q2a_1", "q2a_2")],
output_format = "csv",
file = "tabbook.csv",
format = list(
pval_colors = FALSE,
decimal_places = list(percentages = 0L, other = 2L),
show_empty = FALSE
),
sig_threshold = 0.05,
doc_layout = list(toc = FALSE, variable_sheets = "one_sheet"),
fields = c(
"col_percent", "row_percent", "count_unweighted", "mean",
"valid_count_weighted", "valid_count_unweighted"
),
page_layout = list(
rows = list(
top = c("base_weighted", "base_unweighted"),
bottom = c("scale_mean", "scale_median")
),
measure_layout = "long"
)
)
# JSON export (loads into R)
book <- tabBook(m, ds)
tables <- prop.table(book, 2)
}
Run the code above in your browser using DataLab