FileBlock | R Documentation |
FileBlock
FileBlock
manages file-based content in a report,
ensuring appropriate handling of content files.
teal.reporter::ContentBlock
-> FileBlock
finalize()
Finalize the FileBlock
.
FileBlock$finalize()
Removes the temporary file created in the constructor.
from_list()
Create the FileBlock
from a list.
The list should contain one named field, "basename"
.
FileBlock$from_list(x, output_dir)
x
(named list
) with one field "basename"
, a name of the file.
output_dir
(character
) with a path to the directory where a file will be copied.
self
, invisibly.
FileBlock <- getFromNamespace("FileBlock", "teal.reporter") block <- FileBlock$new() file_path <- tempfile(fileext = ".png") saveRDS(iris, file_path) block$from_list(list(basename = basename(file_path)), dirname(file_path))
to_list()
Convert the FileBlock
to a list.
FileBlock$to_list(output_dir)
output_dir
(character
) with a path to the directory where a file will be copied.
named list
with a basename
of the file.
FileBlock <- getFromNamespace("FileBlock", "teal.reporter") block <- FileBlock$new() block$to_list(tempdir())
clone()
The objects of this class are cloneable with this method.
FileBlock$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## Method `FileBlock$from_list`
## ------------------------------------------------
FileBlock <- getFromNamespace("FileBlock", "teal.reporter")
block <- FileBlock$new()
file_path <- tempfile(fileext = ".png")
saveRDS(iris, file_path)
block$from_list(list(basename = basename(file_path)), dirname(file_path))
## ------------------------------------------------
## Method `FileBlock$to_list`
## ------------------------------------------------
FileBlock <- getFromNamespace("FileBlock", "teal.reporter")
block <- FileBlock$new()
block$to_list(tempdir())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.