R/record_object.R
record_res.Rd
Record, read and write results that capture given characteristics of an object
record_res(
object = ".Last.chunk",
name = object,
fun = NULL,
...,
dir = here::here("tests", "results"),
env = parent.frame()
)
read_res(
name,
...,
dir = here::here("tests", "results"),
nthreads = parallel::detectCores(logical = FALSE)
)
write_res(
object,
name,
...,
dir = here::here("tests", "results"),
nthreads = parallel::detectCores(logical = FALSE)
)
RO(
object = ".Last.chunk",
name = object,
fun = NULL,
...,
dir = here::here("tests", "results"),
env = parent.frame()
)
RN(name, object = ".Last.chunk", fun = NULL, ..., env = parent.frame())
RODFS(
object = ".Last.chunk",
name = object,
fun = df_structure,
...,
env = parent.frame()
)
RNDFS(
name,
object = ".Last.chunk",
fun = df_structure,
...,
env = parent.frame()
)
ROMD5(
object = ".Last.chunk",
name = object,
fun = digest,
...,
env = parent.frame()
)
RNMD5(name, object = ".Last.chunk", fun = digest, ..., env = parent.frame())
ROP(
object = ".Last.chunk",
part = "x",
name = object,
fun = object_part,
...,
env = parent.frame()
)
RNP(
name,
part = "x",
object = ".Last.chunk",
fun = object_part,
...,
env = parent.frame()
)
ROA(
object = ".Last.chunk",
attrib = "class",
name = object,
fun = object_attr,
...,
env = parent.frame()
)
RNA(
name,
attrib = "class",
object = ".Last.chunk",
fun = object_attr,
...,
env = parent.frame()
)
ROSTR(
object = ".Last.chunk",
part = "x",
name = object,
fun = object_str,
...,
env = parent.frame()
)
RNSTR(
name,
part = "x",
object = ".Last.chunk",
fun = object_str,
...,
env = parent.frame()
)
The object to record results from (".Last.chunk"
by default,
which corresponds to the last R object produced in the current chunk in an
R Markdown or Quarto document)
The name of the result file
The function used to compute results for the object
Additional arguments to pass to fun=
or to the read/write
functions using qs::qsave()
and qs::qread()
The directory where to save the results
The environment where to look for the object
The number of threads to use for reading and writing
The part(s) (list item(s)) to use
The attribute(s) to use
The deserialized results for read_res()
or the number of bytes
written invisibly for write_res()
. record_res()
invisibly returns
TRUE
or FALSE
depending on the success of the operation.
The main function to record the results is record_res()
. However, there are
several shortcuts to record specific characteristics of an object: RO
is
the same as record_res()
, RN()
records by default ".Last.chunk"
but
focuses on the name of the result file, RODFS()
records the main structure
of a data frame, RNDFS()
is the same as RODFS()
but focuses on the name
of the result file, ROMD5()
records the MD5 hash of an object, RNMD5()
is
the same focusing on the name, ROP()
records one or several parts of an
object (items from a list), RNP()
is the same focusing on the name, ROA()
records one or several attributes of the objects with RNA()
focusing on the
name, ROSTR()
records the utils::str()
summary of the object, and
RNSTR()
is the same focusing on the name of the result file.