table_glue | R Documentation |
Expressive rounding for table values
table_glue(..., rspec = NULL, .sep = "", .envir = parent.frame())
... |
strings to round and format. Multiple inputs are concatenated together. Named arguments are not supported. |
rspec |
a |
.sep |
Separator used to separate elements |
.envir |
environment to evaluate each expression in. |
a character vector of length equal to the vectors supplied in ...
Other table helpers:
table_ester()
,
table_pvalue()
,
table_value()
x <- runif(10) y <- runif(10) table_glue("{x} / {y} = {x/y}") table_glue("{x}", "({100 * y}%)", .sep = ' ') df = data.frame(x = 1:10, y=1:10) table_glue("{x} / {y} = {as.integer(x/y)}", .envir = df) table_glue("{x} / {y} = {as.integer(x/y)}") with(df, table_glue("{x} / {y} = {as.integer(x/y)}")) mtcars$car <- rownames(mtcars) # use the default rounding specification table_glue( "the {car} gets ~{mpg} miles/gallon and weighs ~{wt} thousand lbs", .envir = mtcars[1:3, ] ) # use your own rounding specification rspec <- round_spec() rspec <- round_using_decimal(rspec, digits = 1) table_glue( "the {car} gets ~{mpg} miles/gallon and weighs ~{wt} thousand lbs", rspec = rspec, .envir = mtcars[1:3, ] )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.