make.fun.club | R Documentation |
This function creates the workflow manager of the class fun.club
which
can be used to create fun.objects as described in help('[<-.fun.club')
.
The workflow will be automatically saved in file
. If file
already
exists when the workflow is created, its content will be read to ...
to do: finish
make.fun.club(
dir,
envir = globalenv(),
extension.selector = function(object) {
is.gg <- function(x) {
any(c("ggplot", "grob") %in% class(x))
}
if (is.gg(object) ||
is.list(object) && all(lapply(object, is.gg) == TRUE)) {
c("rds", "pdf")
}
else if ("data.table" %in% class(object) && all(lapply(object, is.atomic)
== TRUE) && nrow(object) > 0L) {
"fst"
}
else if ("connection"
%in% class(object)) {
"raw"
}
else {
"rds"
}
},
savers = list(rds = c(function(object, file) saveRDS(object, file = file),
function(file) readRDS(file = file)), fst = c(function(object, file)
write.fst(object, path = file, compress = 100), function(file) read.fst(path = file,
as.data.table = TRUE)), raw = c(function(object, file) {
l <- length(object)
writeBin(object = l, size = 8L)
writeBin(object = object, con = file(file),
open = "wb")
}, function(file) {
n.bytes <- readBin(con = file, what =
integer(), n = 1L, size = 8L)
readBin(con = file, what = raw(), n = n.bytes)
}), pdf = c(function(object, file) {
pdf(file)
if ("grob" %in%
class(object)) {
grid.newpage()
grid.draw(object)
} else {
suppressWarnings(print(object))
}
dev.off()
})),
verbose = 2
)
dir |
The name of the directory where all generated objects are
stored. If it exists, all object and |
envir |
environment where the |
extension.selector |
The function receiving the |
savers |
The list containing read / write functions. Every list
element is named by the corresponding file extenson and contains the
list with either one or two functions. The first function receives the
|
verbose |
The integer which controls the amount of the printed
diagnostic information, from 0 to 3 (default = 2). 0 means no output, 1
- only the information on deleted or updated functions is printed, 2 -
additionally, on the deleted and generated objects and on the
operations with the files and the directories, 3 - additionally, on the
stack content during the generation of the objects. All information is
printed using |
created fun.club object (invisibly)
Vladislav BALAGURA balagura@cern.ch
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.