read_blocks() reads the values that write_blocks() wrote. In a knitr
document, fake values put the mark **FAKE DATA** at the top of the
output.
Value
The values: the list that write_blocks() wrote, with its
attributes.
Details
When the values are fake and knitr renders a document,
read_blocks() adds a knitr document hook. The hook puts
**FAKE DATA** at the top of the output, after the YAML header when the
output starts with one. It keeps the document hook that was there.
The knitr option paste0(fake_attribute, "_marked") records the hook, so
a document gets the mark once, however many reads it does. knitr sets its
options and hooks back at the end of each document. Outside knitr, and on
values that are not fake, read_blocks() only reads.
See also
Other blocks:
block(),
check_blocks(),
house_formatters(),
make_blocks(),
txt(),
write_blocks()
Examples
path <- tempfile(fileext = ".qs2")
write_blocks(list(estimates = data.frame(term = "x", estimate = 1.2)), path)
read_blocks(path)
#> $estimates
#> term estimate
#> 1 x 1.2
#>
unlink(path)