Open StaffanBetner opened 1 year ago
Doesn't seem unreasonable. We already change the output notation to show (scaled) entropy for factors and dissent for ordered factors; something like this:
> posterior::rvar(letters)
rvar_factor<26>[1] mode <entropy>:
[1] a <1>
26 levels: a b c d e f g h i j k l m n o p q r s t u v w x y z
Since we already have a summary
option to print.rvar()
that determines the summary functions used, with default determined by getOption("posterior.rvar_summary")
, I'd propose a notation
option to print.rvar()
with default determined by getOption("posterior.rvar_notation")
, with three possible values:
"plus_minus"
: current behavior: plus/minus for numeric rvars, <...>
for factor/ordered"chevrons"
: <...>
for everything"parens"
: (...)
for everythingWe could also allow more custom formatting, e.g. by allowing notation
to take a function that takes a character vector (or maybe numeric vector) of measures of uncertainty and returns a character vector of the same length, formatted as desired. Not sure if this level of customization is really necessary, because at that point you might as well just start formatting things manually by calling the summary functions directly.
While the current
rvar
notation of mean ± sd is straightforward, I think it might be beneficial to offer alternative notations. I've found the mean(sd) style to be quite popular in some contexts, e.g. in physics and chemistry.To give a bit of context, the R package
errors
offers a similar functionality torvar
, but it is only based on mean and standard deviation:Considering this, would it be possible to introduce an R option, say
rvar.uncertainty.notation
? This could let users choose between the currentplusminus
style and the alternativeparenthesis
notation.Thanks for considering!