| text_from_durationy | R Documentation |
durationyA durationy is printed as a decimal.
This format is readable by durationy.character().
## S3 method for class 'durationy'
as.character(x, ...)
## S3 method for class 'durationy'
format(x, include_plus = FALSE, use_true_minus = TRUE, year_unit = "yr", ...)
## S3 method for class 'durationy'
print(
x,
include_plus = FALSE,
use_true_minus = TRUE,
year_unit = "yr",
max = NULL,
...
)
x |
The |
... |
Other arguments. |
include_plus |
Whether to include a plus ('+') sign for positive
durations.
Defaults to |
use_true_minus |
Whether to use the
true minus sign ('-', U+2212)
sign as opposed to the
ASCII hyphen (-, U+002D).
Defaults to |
year_unit |
The year unit name to print.
If not blank then the value is followed by a space and the unit.
Cannot be more than 20 characters (UTF-8 bytes) or contain control characters.
Defaults to |
max |
Numeric or |
as.character and format return a vector of character.
print invisibly returns x.
durationy
pos <- durationy(1)
neg <- durationy(-2.3)
format(pos) # "1 yr"
format(pos, include_plus = TRUE) # "+1 yr"
format(pos, year_unit = "") # "1"
format(neg) # U+2212 (true minus) followed by "2.3" (CRAN-compliance)
format(neg, use_true_minus = FALSE) # "-2.3 yr"
format(neg, use_true_minus = FALSE, year_unit = "a") # "-2.3 a"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.