knitr::opts_chunk$set(echo = FALSE) library(knitr) library(pander) library(kableExtra) library(subpat) library(dplyr)
panderOptions('knitr.auto.asis', FALSE) panderOptions('keep.line.breaks', TRUE) # Needs variables in environment: # subjects # population # datasets if(! is.null(population)) { toPandoc(population) } else { pander::pandoc.header("Subpopulation: No sub-population used", level = 1) } dataset_names <- names(datasets) if ("ADSL" %in% dataset_names) { # Add ADSL to top dataset_names <- union("ADSL", dataset_names) } for(s in subjects) { cat("\\pagebreak\n") pander::pandoc.header(paste0("Subject: ", s), level = 1) for(i in seq_along(dataset_names)) { pander::pandoc.header(names(datasets)[[i]], level = 2) if(length(colnames(datasets[[i]])) > 1) { # Remove the subject id since it is already in the header filtered_ds <- datasets[[i]] %>% filter(get(idvar) == s) filtered_ds <- filtered_ds[, !(idvar == colnames(filtered_ds))] pander::pander(filtered_ds, split.table=120) } else { pander::pandoc.p("No columns selected.") } } }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.