The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Rbearcat provides six bcat_fmt_* functions for formatting numbers in inline
R expressions and tables. They wrap functions from the scales package with
sensible defaults.
| Function | Formats as |
|---|---|
bcat_fmt_dollar() |
Currency ($1,234.56) |
bcat_fmt_percent() |
Percentage (12.3%) |
bcat_fmt_comma() |
Comma-separated (1,234) |
bcat_fmt_scientific() |
Scientific notation (1.23e+06) |
bcat_fmt_date() |
Human-readable date (March 10, 2026) |
bcat_fmt_pvalue() |
P-value with </> notation |
bcat_fmt_dollar()The default uses a hyphen. Set style_negative = "parens" for accounting style:
bcat_fmt_percent()Multiplies by 100 by default (assumes proportions as input):
If values are already in percentage form, set scale = 1:
bcat_fmt_comma()bcat_fmt_scientific()bcat_fmt_date()Converts character or Date objects to a human-readable format. The default
format is "%B %e, %Y" (e.g., “January 5, 2026”).
bcat_fmt_pvalue()Uses < and > notation for extreme values:
Useful in inline reporting:
These formatters are most powerful inside inline R expressions in RMarkdown or Quarto. For example, suppose you compute some values:
avg_price <- 12345.67
pct_change <- 0.052
my_pval <- 0.003
bcat_fmt_dollar(avg_price)
#> [1] "$12,345.67"
bcat_fmt_percent(pct_change)
#> [1] "5%"
bcat_fmt_pvalue(my_pval, add_p = TRUE)
#> [1] "p=0.003"In your RMarkdown document you would reference these with inline R code like
`r bcat_fmt_dollar(avg_price)` to produce formatted
numbers directly in your prose:
The average price was $12,345.67 with a 5% year-over-year change. The coefficient was significant (p=0.003).
The bcat_fmt_* functions can also serve as label functions for ggplot2 axis
scales:
library(ggplot2)
set_UC_geoms()
ggplot(economics, aes(date, pce)) +
geom_line() +
scale_y_continuous(labels = bcat_fmt_dollar) +
labs(title = "Personal Consumption Expenditure",
x = NULL, y = "Billions ($)") +
theme_UC()These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.