make_link {saros} | R Documentation |
Save data to a file and return a Markdown link
Description
The file is automatically named by a hash of the object, removing the need to come up with unique file names inside a Quarto report. This has the added benefit of reducing storage needs if the objects needing linking to are identical, and all are stored in the same folder. It also allows the user to download multiple files without worrying about accidentally overwriting them.
Usage
make_link(
data,
folder = NULL,
file_prefix = NULL,
file_suffix = ".csv",
save_fn = utils::write.csv,
link_prefix = "[download figure data](",
link_suffix = ")",
...
)
Arguments
data |
Data or object
Data frame if using a tabular data |
folder |
Where to store file
Defaults to same folder. |
file_prefix , file_suffix |
File prefix/suffix
|
save_fn |
Saving function
Can be any saving/writing function. However, first argument must be
the object to be saved, and the second must be the path. Hence,
|
link_prefix , link_suffix |
Link prefix/suffix
The stuff that is returned. |
... |
Dynamic dots Arguments forwarded to the corresponding functions that create the elements. |
Value
String.
Examples
make_link(mtcars, folder = tempdir())