What if we store all R objects that have been ever created?
Goals for the archivist package:
The archivist is an R package for management of R objects outside R session. It stores binary copies of R objects in rda files and provides easy access for seeking and restoring these objects based on timestamps, classes or other properties
But, why anybody would like to store copies of all R objects?
Enrich knitr reports with hooks for selected objects. Example.
archivist::aread("pbiecek/Eseje/arepo/e10f9d223df408fca73ea548456493f4")
Enrich shiny applications with hooks to displayed plots. Example.
library(archivist) createLocalRepo("arepo", default = TRUE) model <- lm(Sepal.Length ~ Petal.Length + Species, data=iris) saveToLocalRepo(model) library(ggplot2) plot <- ggplot(iris, aes(Sepal.Length, Petal.Length)) + geom_point() saveToLocalRepo(plot)
# from the default local repository aread("e700c6704890022a4e0277e11cd46488") # from the github pbiecek/graphGallery repository aread("pbiecek/graphGallery/18a98048f0584469483afb65294ce3ed")
lm
models that are in a repository, apply BIC criteria and sort models.models <- asearch("pbiecek/graphGallery", patterns = "class:lm") modelsBIC <- sapply(models, BIC) sort(modelsBIC)
gallery
with rda
dumps of recorded objects,an SQLite database (file backpack.db
).
The database contains two tables, with artifacts and their properties and relations.
format:...
, name:...
, class:...
, date:...
.library("dplyr") iris %a% dplyr::filter(Sepal.Length < 6) %a% lm(Petal.Length~Species, data=.) %a% summary() -> tmp
ahistory(md5hash = "050e41ec3bc40b3004bc6bdd356acae7", format = "kable", alink = TRUE)
ahistory(tmp)
ggplot2
).sessionInfo
is stored.asession("050e41ec3bc40b3004bc6bdd356acae7") # restoreLibs("pbiecek/graphGallery/arepo/600bda83cb840947976bd1ce3a11879d")
@MarcinKosinski
(coauthor of the archivist).allModels
.createLocalRepo("allModels", default = TRUE) trace(lm, exit = quote(saveToLocalRepo(z, repoDir="allModels")))
addHooksToPrint(class=c("ggplot", "data.frame"), repoDir = "arepo", repo = "Eseje", user = "pbiecek", subdir = "arepo")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.