Learn R Programming

archivist (version 2.3.8)

ahistory: Show Artifact's History

Description

ahistory extracts artifact's history and creates a data frame with history of calls and md5hashes of partial results. The overloaded print.ahistory function prints this history in a concise way. The overloaded print.ahistoryKable function prints this history in the same way as kable. When alink=TRUE one can create history table/kable with hooks to partial results (artifacts) as in the alink function.

Usage

ahistory(
  artifact = NULL,
  md5hash = NULL,
  repoDir = aoptions("repoDir"),
  format = "regular",
  alink = FALSE,
  ...
)

Value

A data frame with two columns - names of calls and md5hashes of partial results.

Arguments

artifact

An artifact which history is supposed to be reconstructed. It will be converted into md5hash.

md5hash

If artifact is not specified then md5hash is used.

repoDir

A character denoting an existing directory in which an artifact will be saved.

format

A character denoting whether to print history in either a "regular" (default) way or like in a "kable" function. See Notes.

alink

Whether to provide hooks to objects like in alink. See examples.

...

Further parameters passed to alink function. Used when format = "kable" and alink = TRUE.

Contact

Bug reports and feature requests can be sent to https://github.com/pbiecek/archivist/issues

Demonstration

This function is well explained on this blog post.

Author

Przemyslaw Biecek, przemyslaw.biecek@gmail.com

Marcin Kosinski, m.p.kosinski@gmail.com

Details

All artifacts created with %a% operator are archivised with detailed information about it's source (both call and md5hash of the input). The function ahistory reads all artifacts that precede artifact and create a description of the input flow. The generic print.ahistory function plots the history in a human readable way.

References

Biecek P and Kosinski M (2017). "archivist: An R Package for Managing, Recording and Restoring Data Analysis Results." _Journal of Statistical Software_, *82*(11), pp. 1-28. doi: 10.18637/jss.v082.i11 (URL: http://doi.org/10.18637/jss.v082.i11). URL https://github.com/pbiecek/archivist

See Also

Other archivist: Repository, Tags, %a%(), addHooksToPrint(), addTagsRepo(), aformat(), alink(), aoptions(), archivistPackage, aread(), areadLocal(), asearch(), asearchLocal(), asession(), atrace(), cache(), copyLocalRepo(), createLocalRepo(), createMDGallery(), deleteLocalRepo(), getRemoteHook(), getTagsLocal(), loadFromLocalRepo(), md5hash, removeTagsRepo(), restoreLibs(), rmFromLocalRepo(), saveToLocalRepo(), searchInLocalRepo(), setLocalRepo(), shinySearchInLocalRepo(), showLocalRepo(), splitTagsLocal(), summaryLocalRepo(), zipLocalRepo()

Examples

Run this code

createLocalRepo("ahistory_check", default = TRUE)
library(dplyr)
iris %a%
filter(Sepal.Length < 6) %a%
 lm(Petal.Length~Species, data=.) %a%
 summary() -> artifact
 
ahistory(artifact)
ahistory(artifact, format = "kable")  
print(ahistory(artifact, format = "kable"), format = "latex")
ahistory(artifact, format = "kable", alink = TRUE, repoDir = "ahistory_check",
repo = "repo", user = "user")


repoDir <- file.path(getwd(), "ahistory_check")
deleteLocalRepo(repoDir, deleteRoot = TRUE)
aoptions('repoDir', NULL, unset = TRUE)

Run the code above in your browser using DataLab