View source: R/save_tex_value.R
| save_tex_value | R Documentation |
save_tex_value saves pairs of values and names of commands to be
associated with them to a special formatted '.tex' file.
save_tex_value( values, names, file_name, path = NULL, translate = TRUE, digits = 2, percent = FALSE, accuracy = 1, override = TRUE )
values |
Numeric, character or logical vector of values to be saved. Logical values will be saved as character. |
names |
Character vector of names. Each name must be unique and can consist of letters only. |
file_name |
File name to create on disk. |
path |
Path to the directory to save the file to. |
translate |
Logical indicating whether to save values in LaTeX format.
See |
digits |
The desired number of digits after the decimal point for numeric non-percent values. Defaults to 2 digits after the decimal point. |
percent |
Logical scalar or vector. If |
accuracy |
A number to round percent values to. Use (e.g.) 0.01 to show 2 decimal places of precision. Defaults to 1 i.e round to the nearest integer. |
override |
Logical indicating whether to override values if a value with the same name already exits in the file. |
## Not run:
file <- tempfile()
save_tex_value(values = 1:3, names = c("a","b","c"), file_name = file)
# Save percent values to the same file
save_tex_value(values = 0.5, names = "halfPer", file_name = file, percent = TRUE)
# override "a" with a different value
a <- rnorm(1)
save_tex_value(values = a, names = "a", file_name = file, digits = 4)
# delete file with base::unlink()
unlink(paste0(file,".tex"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.