Format numbers (with uncertainty) according to the "Guide to the Expression of Uncertainty in Measurement (GUM)"
format_GUM.RdUncertainties are rounded by default to two significant digits. Then, the values are rounded to the precision implied by the uncertainty. If the uncertainty is missing, values are rounded to two significant digits by default. The number of digits and the justification of the output format can be changed.
format_GUM(
value,
se = NULL,
digits = 2,
justify = c("decimal", "left", "right", "centre"),
na.string = "--",
...
)Arguments
- value
numeric values to be formatted.
- se
uncertainty values for
value, either absolute (e.g. 0.93) or relative (e.g. "12%"). Defaults toNULL, in which casevalueis rounded according todigits.- digits
number of significant digits to which
seorvalue(ifseis missing) is rounded.- justify
character (decimal, left, right or centre) to determine the output format if
length(value) > 1.- na.string
instead of
NAwrite na.string.- ...
additional arguments going to base
format.
Value
Character vector of rounded and justified values.
References
ISO, IEC, and BIPM OIML. Guide to the Expression of Uncertainty in Measurement. Geneva, Switzerland 1995.
See also
Other Auxiliary:
IQRloadCSVdata(),
IQRsaveCSVdata(),
and(),
aux_explode(),
aux_explodePC(),
aux_fileparts(),
aux_fileread(),
aux_filewrite(),
aux_getRelPath(),
aux_mkdir(),
aux_na_locf(),
aux_postFillChar(),
aux_preFillChar(),
aux_quantilenumber(),
aux_rmdir(),
aux_simplifypath(),
aux_splitVectorEqualPieces(),
aux_strFindAll(),
aux_strrep(),
aux_strtrim(),
aux_unlevel(),
aux_version(),
calcAICBIC(),
clusterX(),
compare_IQRmodel_IQRsysModel_simulation(),
fit_EmaxModel(),
ge(),
gen_aux_version(),
geocv(),
geomean(),
geosd(),
ginv(),
gt(),
interp0(),
interp1(),
interpcs(),
inv_logit(),
le(),
logit(),
lt(),
mod(),
mvrnorm(),
norm_M3(),
or(),
piecewise(),
progressBar(),
remove_duplicates(),
run_silent_IQR(),
stopIQR(),
tempdirIQR(),
tempfileIQR(),
warningIQR()
Examples
if (FALSE) { # \dontrun{
value <- c(2.0873624, 0.0057687, 0.087865, 3856.9898273, 1736.8735123)
se <- c(0.0013756, 0.001765, 0.0006782, 9.23958, 124.79823)
niceTable <- data.frame(
Value = format_GUM(value, se),
StdErr = format_GUM(se)
)
print(niceTable)
# Another example assuming 10% uncertainty for all values
format_GUM(value, se = "10%")
} # }
