Title: | Reproducible Data Objects |
---|---|
Description: | A Reproducible Data Object (RDO) encapsulates both data and R code needed to reproduce those data. Each RDO can have other RDOs as dependencies. RDOs can be composed into complex tree hierarchies. Interacting with an RDO tree is similar to interacting with a single RDO. You can (re)run the code and refresh the cache, check status, validate if the code still gives the same cached data, clear data cache, access code and data cache of any of the dependencies. RDOs can be cloned and code of cloned dependencies can be modified. |
Authors: | Kamil Wais [aut, cre] |
Maintainer: | Kamil Wais <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-12 04:10:37 UTC |
Source: | https://github.com/openpharma/RDO |
Create and interact with Reproducible Data Objects.
print()
Default print method of current RDO status
RDO$print(...)
...
Other params for print function.
new()
Creating a new RDO object,
RDO$new(name, dependencies = list())
name
Unique name of the object.
dependencies
An RDO object or a list of RDO objects.
A new 'RDO' object.
get_status()
Getting current status.
RDO$get_status()
A list.
get_name()
Getting object name.
RDO$get_name()
A character with object name.
has_dependencies()
Checking if object has dependencies.
RDO$has_dependencies()
TRUE if has or FALSE if not.
add_dependencies()
Adding new or update existing RDO dependencies.
RDO$add_dependencies(dependencies = list())
dependencies
An RDO object or a list of RDO objects.
The RDO object (self) returned invisibly.
get_dependencies()
Getting dependencies of the object.
RDO$get_dependencies(deep = FALSE)
deep
A logical. Should the function return only direct dependencies (FALSE) or also deep indirect dependencies (dependencies of dependencies). Default is FALSE.
A named list of RDO dependencies with unique names.
get_dependency_register()
Getting dependency register showing which RDO is a direct parent for other RDO dependencies.
RDO$get_dependency_register()
A data.frame.
plot_dependencies()
Plotting the tree of RDO dependencies.
Needs visNetwork
package for plotting.
RDO$plot_dependencies()
get_code()
Getting reproducible R code.
RDO$get_code(deep = FALSE)
deep
A logical. Should the function return only code for this particular RDO (FALSE) or also from all dependencies. Default is FALSE.
An R named expression.
print_code()
Printing reproducible R code.
RDO$print_code(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function return only code for this particular RDO (FALSE) or also from all dependencies. Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
A character. Reproducible R code returned invisibly.
run()
Running reproducible R code.
RDO$run(deep = FALSE, cache = TRUE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function run only code for this particular RDO (FALSE) or should it run also dependencies' code if they are not validated. The function is lazy and it checks if all deep dependencies are validated first. If so, there is no need to rerun their code again. Default is FALSE.
cache
A logical. Should the result of code evaluation be cached inside an RDO object. Default is TRUE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
The RDO object (self) returned invisibly.
is_validated()
Checking if RDO is validated. A RDO is validated when the result of running reproducible R code saved inside the RDO is the same as data cached inside the RDO.
RDO$is_validated(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function validate only this particular RDO (FALSE) or should it validate also all deep dependencies (TRUE). Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
A logical. TRUE if RDO is validated, FALSE if not.
invalidate()
Invalidating the RDO explicitly by setting the 'is_validated' status to 'FALSE'.
RDO$invalidate(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function invalidate only this particular RDO (FALSE) or should it invalidate also all deep dependencies (TRUE). Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
The RDO object (self) returned invisibly.
validate()
Validating the RDO explicitly by running deep reproducible R code and checking if the result is the same as cached data inside the RDO.
RDO$validate(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function validate only this particular RDO (FALSE) or should it validate also all deep dependencies (TRUE). Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
The RDO object (self) returned invisibly.
lock()
Locking the RDO object. When RDO object is locked you cannot change the R code and data cache saved inside the object.
RDO$lock(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function lock only this particular RDO (FALSE) or should it lock also all deep dependencies (TRUE). Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
The RDO object (self) returned invisibly.
unlock()
Unlocking previously locked RDO object.
RDO$unlock(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function unlock only this particular RDO (FALSE) or should it unlock also all deep dependencies (TRUE). Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
The RDO object (self) returned invisibly.
is_locked()
Checking if an RDO object is locked.
RDO$is_locked(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function check only this particular RDO (FALSE) or should it check also all deep dependencies (TRUE). Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
A logical. TRUE if RDO is locked, FALSE if not.
prune_cache()
Pruning (clearing) RDO data cache by setting cache to NULL. It can save memory when we no longer need to keep cache in dependencies.
RDO$prune_cache(deep = FALSE, verbose = Sys.getenv("RDO_VERBOSE"))
deep
A logical. Should the function prune cache of only this particular RDO (FALSE) or should it prune cache also of deep dependencies (TRUE). If an RDO is locked the cache in this particular RDO is not pruned. Default is FALSE.
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
The RDO object (self) returned invisibly.
prune_dependencies()
Pruning RDO dependencies by ensuring that RDO objects in deep dependencies with the same name point to the same RDO objects. This type of pruning may be useful after deep clonning of complex RDO tree with duplicated dependencies.
RDO$prune_dependencies(verbose = Sys.getenv("RDO_VERBOSE"))
verbose
A logical.
Should the messages be sent to console.
If the param is not set, it is read from
an environmental variable RDO_VERBOSE
.
If the variable is not set, than the default is TRUE.
The RDO object (self) returned invisibly.
clone()
The objects of this class are cloneable with this method.
RDO$clone(deep = FALSE)
deep
Whether to make a deep clone.