write_int {tldr} | R Documentation |
Format an interval for display
Description
write_int
formats a numeric input into an interval to be printed, e.g., in an RMarkdown document.
Usage
write_int(x, delim = "(", digits = 2)
Arguments
x |
A length-2 numeric vector consisting of the endpoints of the interval or an n-row by 2-column matrix of endpoints. |
delim |
The bracket delimiters to surround the interval. Must be either a round bracket, square bracket, curly bracket, or angled bracket. |
digits |
Number of digits to round to (default to 2). Will keep trailing zeros. |
Details
If a matrix is provided, the values in each row will be used to create a formatted interval.
Value
Returns a character string of the form "(x[1], x[2])" (or supplied bracket delimiter).
Examples
write_int(x=c(1.2, 2.345))
write_int(x=c(1.2, 2.345), delim='[')
[Package tldr version 0.4.0 Index]