library(dplyr)
\clearpage
Mostly working with this data; but some others come in later to illustrate certain features.
library(pmtables) library(yspec) library(dplyr) spec <- ys_help$spec() data <- pmt_summarized head(data)
\clearpage
data %>% st_new() %>% stable(cols_bold = TRUE) %>% st_asis()
\clearpage
data %>% st_data() %>% st_files(r = "foo.R", output = "foo.tex") %>% st_notes( "Data were analyzed in quadruplicate.", "The results are very clear." ) %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_files("foo.R", "foo.tex") %>% st_noteconf(type = "minipage", width = 0.85) %>% st_notes( "Data were analyzed in quadruplicate.", "The results are very clear." ) %>% stable() %>% st_asis()
\clearpage
STUDY
(left)DOSE
and SCR
(right)data %>% st_new() %>% st_align("c", STUDY = 'l', .r = "DOSE,SCR") %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_center(STUDY = 'l', .r = "DOSE,SCR") %>% st_units(WT = "kg", SCR = "mg/dL", DOSE = "mg") %>% stable() %>% st_asis()
Alternatively
units <- ys_get_unit(spec, parens = TRUE) data[1:3,] %>% st_new() %>% st_center(STUDY = 'l', .r = "DOSE,SCR") %>% st_units(units) %>% stable() %>% st_asis()
\clearpage
...
to breakdata %>% st_new() %>% st_rename("Study...Number" = STUDY, "Serum...Albumin" = ALB) %>% st_units(units) %>% stable() %>% st_asis()
\clearpage
$
are "math" and will not be sanitizedptab <- readRDS("datasets/ptab.RDS") ptab
ptab %>% st_data() %>% st_center(Parameter = col_ragged(3), .l = "Symbol") %>% st_panel(".type") %>% stable() %>% st_asis()
\clearpage
st_new(data) %>% st_hline(from = "STUDY") %>% stable() %>% st_asis()
\clearpage
st_new(data) %>% st_hline(at = c(3,nrow(data))-1) %>% stable() %>% st_asis()
\clearpage
tmp <- readRDS("datasets/with-total.RDS") st_new(tmp) %>% st_hline(pattern = "all", cols = "STUDY", n = 2) %>% stable() %>% st_asis()
\clearpage
tmp <- readRDS("datasets/with-total.RDS") st_new(tmp) %>% st_hline(at = 3, n = 2) %>% stable() %>% st_asis()
\clearpage
tmp <- readRDS("datasets/with-total.RDS") st_new(tmp) %>% st_hline(at = 3, n = 2) %>% st_bold(cols = "STUDY", pattern = "all") %>% st_edit(pattern = "all", replacement = "All studies") %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_hline(from = "STUDY") %>% st_clear_reps("STUDY") %>% stable() %>% st_asis()
\clearpage
pattern
pattern
clear_rep
and hline_from
to partition the tabletmp <- ptdata() tmp <- mutate(tmp, STUDY = tex_bold(as.character(STUDY)))
tmp %>% st_new() %>% st_clear_reps(STUDY) %>% st_hline(from = "STUDY") %>% stable() %>% st_asis()
\clearpage
tmp <- ptdata()
tmp %>% st_new() %>% st_clear_reps(STUDY, .now = TRUE) %>% st_hline(pattern = "\\S+", cols = "STUDY") %>% st_bold(cols = "STUDY") %>% st_it("DOSE") %>% st_edit("\\bmale", "dude") %>% st_edit("female", "gal") %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_center(DOSE = 'l', SCR = 'r') %>% st_panel("STUDY", prefix = "Study number: ") %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_left(.c = "WT,AGE,CRCL") %>% st_span("In final model", WT:CRCL) %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_span("Meh", DOSE:WT) %>% st_span("Hrm", AGE:CRCL) %>% st_span("Huh", ALB:SCR) %>% st_span("Expert opinion", CRCL:SCR, level = 2) %>% stable() %>% st_asis()
\clearpage
tag.name
dotdata <- readRDS("datasets/with-dots.RDS") head(dotdata, n=2)
dotdata %>% st_new() %>% st_span_split(sep = '.') %>% stable() %>% st_asis()
\clearpage
descr is
taking over the tableptable <- readRDS("datasets/ptable.RDS") ptable %>% st_new() %>% stable() %>% st_asis()
descr
to 5 cmptable %>% st_new() %>% st_align(descr = col_ragged(5)) %>% stable() %>% st_asis()
\clearpage
We can point to one or more rows and style it up as a "summary row"
df.total <- readRDS(file = "datasets/with-total.RDS") df.total
st_new(df.total) %>% st_sumrow(pattern = "all", label = "All studies", bold = TRUE) %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_sizes(font = "tiny") %>% stable() %>% st_asis()
\clearpage
sl <- data %>% slice(1:3) sl %>% st_new() %>% stable() %>% st_asis() sl %>% st_new() %>% st_sizes(row = 0.9) %>% stable() %>% st_asis() sl %>% st_new() %>% st_sizes(row = 2 ) %>% stable() %>% st_asis()
\clearpage
data %>% st_new() %>% st_sizes(col = 20) %>% stable() %>% st_asis()
\clearpage
longd <- bind_rows(data, data, data, data) longd %>% st_new() %>% st_files(r = "demo-pipe.Rmd") %>% st_notes("This example demonstrates how to make long table") %>% st_args(lt_cap_text = "Adding a caption to the table") %>% st_args(lt_cap_label = "tab:demographics") %>% stable_long() %>% st_asis()
\clearpage
Rather than passing dots to stable()
or stable_long()
, you can
use st_args()
. But note that this is destructive to previous work; it assumes
you are completely specifying the contents for a given argument. Note that you
can pass arguments through st_args()
or directly to stable()
(or
stable_long()
), but you shouldn't need to do both. See this example:
data %>% st_new() %>% st_notes("xyz") %>% st_args(r_file = "demo-pipe.Rmd", notes = "abc") %>% st_args(output_file = "demo-pipe.tex") %>% stable() %>% st_asis()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.