knitr::opts_chunk$set( collapse = TRUE, comment = "." )
For continuous data summaries, the number of digits can be
controlled by setting the digits
option with a digits
object.
Create a new digits object
library(pmtables) x <- new_digits() x
By default, pmtables will format numeric summaries with 3 significant digits.
To use a default of 2 significant digits
x <- new_digits(.default = 2) x
To customize the number of digits for each data summary
x <- new_digits(WT = 3, ALB = 4, SCR = 2) x
This will use 3 significant digits for WT
, 4 for ALB
and
2 for SCR
.
We can also round digits. It is safest to create your own wrapper
for round instead of using round
(a primitive function)
x <- new_digits(.fun = round) x
Use the digits
option
This should give us 2 digits in all columns except for WT
,
which should be 3 digits
dig <- new_digits(.default = 2, WT = 3) dig
pt_opts$set(digits = dig)
data <- pmtables:::data("id")
pt_cont_long( data, cols = "WT,ALB,SCR,CRCL" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.