-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rounding #11
Labels
enhancement
New feature or request
Comments
I'd recommend setting default rounding as a package option |
100% Only question would be how to allow the user to override that behaviour on an ad hoc one-off basis |
Hmmm, good call |
I reckon a global option, Then we add a transformer to can_numeric <- function (x) {
!any(!is.na(x) & is.na(suppressWarnings(as.numeric(x))))
}
round_transformer <- function(digits = getOption("prj_digits")) {
function(text, envir) {
if (can_numeric(text)) text <- round(as.numeric(text), digits)
glue::identity_transformer(text, envir)
}
} And we have in if (!is.null(digits)) {
oldopts <- options(list(prj_digits = digits)
on.exit(options(oldopts))
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently pretty much every shadow will include a call to
signif
, e.g.We should do rounding to 2 significant figures by default
The text was updated successfully, but these errors were encountered: