r_signif | R Documentation |
Formatting a numerical vector x
to a character vector. The format will be defined with respect to the significant digits for each vector index x[]
.
So the string length of an vector index may vary according to the max(x
) and min(x
) supplied.
r_signif(x, significant_digits = 3)
x |
numerical vector |
significant_digits |
number of significant digits you prefer. |
creates the same result as the Base R function format(x
, format = "g", digits = 3), it's just a wrapper with my preferred parameters.
character vector
Florian Wagner florian.wagner@wagnius.ch
set.seed(123456)
test <- c(25,signif(rnorm(10),3))
test|>paste0()|>writeLines()
test|>r_signif()|>writeLines()
test|>format(format = "g", digits = 3)|>writeLines()
c(25,9255666,0.0000034646465321)|>r_signif()|>writeLines()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.