If you ever get tired of having to write
table_glue(..., rspec = your_rspec)
and would rather just write
table_glue(...)
, you can use the default_rounder_set()
function
on your_rspec
to temporarily update options
in your current R
session and update the default rounding specification to match
whatever your current rounding specification is.
Naturally, mistakes will be made when default_rounder_set()
is used.
To reset the rounding specifications to factory defaults,
use default_rounder_reset()
.
default_rounder_set(rspec) default_rounder_reset()
rspec | a |
---|
default_rounder_set()
changes global options and does
not return a value.
Setting a default rounding specification will impact
all functions in the table helpers
family. Use with caution! Also,
please make all use of default_rounder_set()
explicit
in your code so that it can be reproduced. It is highly recommended
that you do not use default_rounder_set()
in your .Rprofile.
your_rspec <- round_using_decimal(round_spec(), digits = 10) your_rspec <- format_small(your_rspec, mark = '--') # now your_rspec is the default. default_rounder_set(your_rspec) # so it is applied whenever you use table_value(), # unless you specify otherwise. table_value(rnorm(5))#> [1] "-1.40004--35167" "0.25531--70548" "-2.43726--36112" "-0.00557--12867" #> [5] "0.62155--27214"# don't forget to reset when you're done default_rounder_reset()