Wording that arithmetic fixes (rule 3.5). Each returns a weft_text.
They print English words, so under a lang weft does not ship they are a
construct error (rule 1.6.8).
Usage
of_n(k, n, singular, plural)
about(x, to = 1/2, tolerance = NULL)
ci(
est,
lo,
hi,
level = NULL,
digits = NULL,
sigfig = NULL,
plus = FALSE,
pct = FALSE,
short = NULL
)
pm(est, se, digits = NULL, sigfig = NULL)
clamp(x, floor = NULL, ceiling = NULL)Arguments
- k, n
Whole numbers,
0 <= k <= n,n > 0.- singular, plural
The noun, in each form.
- x
A number.
- to
The target of
about().- tolerance
The largest distance from
tothatabout()accepts.- est, lo, hi, se
Numbers.
- level
The confidence level of
ci(), as a proportion.- digits, sigfig
Decimal places or significant figures, as for
fmt_num().- plus, pct, short
TRUEorFALSE(shortalsoNULL) forci(); see above.- floor, ceiling
The bounds of
clamp();NULLfor none.
Details
of_n(k, n, singular, plural)prints "none of the 4 sites", "the only site", "both sites", "all 5 sites" or "3 of the 7 sites". Its number isk, so annspan after it agrees with it (rule 3.5.2).about(x, to, tolerance)prints "nearly half", "just over half" or "half".tois one of 1/4, 1/3, 1/2, 2/3 and 3/4.xandtoare compared as percentages rounded to whole numbers. Anxfurther thantolerancefromtois a value error, because the sentence would be false. The default tolerance is the settingabout_tolerance(0.05).ci(est, lo, hi, level, digits, sigfig, plus, pct, short)prints "2.1 (95% CI 1.3 to 2.9)". The default level is the settingci_level(0.95).plus = TRUEsigns the three numbers as.plusdoes;pct = TRUEprints each as.pctdoes;short = TRUE(default: the settingci_short) leaves out "95% CI", and alevelgiven with the short form is aweft_value_error.pm(est, se, digits, sigfig)prints the estimate, a plus-minus sign and the standard error. Whendigitsandsigfigare not given and a number ofci()orpm()that is not zero prints as zero, one warned check of kind "printed as zero" is recorded for the call, as forfmt_num().clamp(x, floor, ceiling)prints the value as.numdoes inside the bounds, and "< floor" or "> ceiling" outside, with the relation of the printed record set (rule 3.5.4).
Given a quantity (a units value, see u()), of_n() and about() use
its number and print no unit: they print words. ci(), pm() and
clamp() do not take a quantity that has a unit (rule 4.4.8) and stop
with a weft_value_error; pass the numbers, or format the parts with
fmt_num(); so does a formatter's text that carries a unit. Given two
quantities, of_n() converts n to the unit of k, and about() converts
x to the unit of to; units that do not convert are a weft_value_error.
A ratio, which has no unit left, is a number.