#'
#' The object generated by `qwraps2::summary_table` is a character matrix with
#' the class attribute `qwraps2_summary_table`. The
#' `qwraps2:::print.qwraps2_summary_table` and `qwraps2:::print.qable` methods
#' are responsible for the way the table is presented in the output. Chunk
#' options will be responsible for how the table is rendered in the output
#' document.
#'
#'
#' **Update:** as of qwraps2 version 0.5.0 the use of the `.data` is no longer
#' needed or recommended.
options(qwraps2_markup = "markdown")
library(qwraps2)
eg_data <- data.frame(Age = rnorm(1000, mean = 54, sd = 10))
age_summary <- list("Age" =
list(
"Min" = ~ min(Age),
"Max" = ~ max(Age),
"Mean" = ~ mean_sd(Age)
)
)
age_table <- summary_table(eg_data, age_summary)
#'
#' Take a look at the structure of `age_table`
#'
str(age_table)
#'
#' As noted above, the object is a 3 x 1 character matrix of class
#' `qwraps2_summary_table`. To see the return in the R console:
print.default(age_table)
#'
#' Since the `options(qwraps2_markup = "markdown")` as been set, the printing
#' method will return a markdown table
age_table
#'
#' Make sure you have the `results = "asis"` chunk option set in your .Rmd file
#' so that the table will render correctly in your output document.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.