Description Usage Arguments Value Leading zero Trailing zero Examples
Use snip()
if you need to trim a leading zero (left of decimal) or trailing zero (right of decimal) from a value (esp. for reporting stats in APA format).
1 |
x |
A numeric value, coercible to a character. |
lead |
Optional number of zeros to remove from the left of the decimal. Default is |
trail |
Position for evaluating whether a trailing zero should be dropped? Defaults to |
x
as a string with leading and/or trailing zero removed.
For values that cannot exceed 1, (e.g., p values), APA recommends removing the zero to the left of the decimal.
For example p = 0.023 should be reported as p = .023. In this case, snip(0.023), lead = 1
would work.
If, for some reason, you need to snip more than one zero, you can specify the number.
Only exact matches (e.g., 1 or 2 "0"s, set by lead
) for x < 1
will be snipped; otherwise, the value to the left of the decimal is left unchanged.
The APA recommends reporting statistics with decimal fractions rounded to two or three places (in most circumstances).
When trail = 3
, the default behavior is to assume that a minimium of 2 places after the decimal should be preserved under all conditions. This basically sets the position being evaluated = 3, and assumes the APA-recommended floor threshold of .001: If there is a zero in this position, the zero is snipped.
See examples and APA_p
.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.