Closed mikabr closed 4 years ago
also we use round
as our function for rounding but it has terrible properties.
how's this for a bad piece of code to replace it:
Round <- function (x, digits = 1) {
if (digits == 1) {
sprintf("%.1f", round(x, digits = 1))
} else if (digits == 2) {
sprintf("%.2f", round(x, digits = 2))
}
}
I'm sure by putting this awful if statement in front of you it will induce you to fix it @mikabr ?
in general our problem is that we want significant digits but we want the final zeros printed too.
note that chapter 8 has its own digits settings in its preamble, that's one approach we could use?
I've change number printing pretty much everywhere to be:
roundp <- function(x, digits = 2) {
sprintf(glue('%.{digits}f'), round(x, digits)) %>% str_replace("-", "–")
}
we can make adjustments to it centrally!
right now some are in within latex math mode and some are in plain text