save_reactable_test: Save a reactable table as an image or .html file

View source: R/save_reactable.R

save_reactable_testR Documentation

Save a reactable table as an image or .html file

Description

The 'save_reactable()' function converts either a reactable table, .html file, or .Rmd file to an image or .html file and saves it in the user's working directory. Table can be saved as either a .png file or .html file. Other file types are not currently supported. If the reactable table is located within an .Rmd file and has additional CSS styles provided, specify the name of the .Rmd file as the input. Alternatively, if the reactable table exists in an .html file, specify the name of the .html file as the input. Additional parameters available within webshot::webshot such as vwidth, vheight, and cliprect can be passed through 'save_reactable()'.

Usage

save_reactable_test(input, output, ...)

Arguments

input

A reactable table, .html file, or .Rmd file

output

A .png or .html file name for the saved image

...

Optional additional parameters passed from webshot::webshot

Value

a function that converts a reactable table, .html file, or .Rmd file to an .png file or .html file and saves it in the user's working directory.

Examples

## Not run: 
## Save reactable table as a png file:
iris_table <- reactable(iris)
save_reactable(iris_table, "iris_table.png")

## Also works with a pipe
iris_table %>%
save_reactable("iris_table.png")

## Or save as an html file:
save_reactable(iris_table, "iris_table.html")

## If the reactable table was built in R Markdown with CSS styles applied,
## specify .Rmd file as input and save_reactable will run the file
## and save the output as an image
save_reactable("iris_table.Rmd", "iris_table.png")

## Alternatively, can do the same with an .html file
save_reactable("iris_table.html", "iris_table.png")

## End(Not run)

reactablefmtr documentation built on March 18, 2022, 5:08 p.m.