Load Artifact Given as a md5hash from a Repository

loadFromLocalRepo loads an artifact from a local Repository into the workspace. loadFromRemoteRepo loads an artifact from a github / git / mercurial Repository into the workspace. To learn more about artifacts visit archivist-package.

loadFromLocalRepo(md5hash, repoDir = aoptions("repoDir"),
  value = FALSE)

loadFromRemoteRepo(md5hash, repo = aoptions("repo"), user = aoptions("user"), branch = aoptions("branch"), subdir = aoptions("subdir"), repoType = aoptions("repoType"), value = FALSE)


A character assigned to the artifact through the use of a cryptographical hash function with MD5 algorithm, or it's abbreviation.


A character denoting an existing directory from which an artifact will be loaded.


If FALSE (default) then artifacts are loaded into the Global Environment with their original names, if TRUE then artifacts are returned as a list of values (if there is more than one artifact) or as a single value (if there is only one arfifact that matches md5hash).


While working with a Remote repository. A character containing a name of a Remote repository on which the Repository is archived. By default set to NULL - see Note.


While working with a Remote repository. A character containing a name of a Remote user on whose account the repo is created. By default set to NULL - see Note.


While working with a Remote repository. A character containing a name of Remote Repository's branch on which the Repository is archived. Default branch is master.


While working with a Remote repository. A character containing a name of a directory on Remote repository on which the Repository is stored. If the Repository is stored in main folder on Remote repository, this should be set to subdir = "/" as default.


A character containing a type of the remote repository. Currently it can be 'Remote' or 'bitbucket'.


Functions loadFromLocalRepo and loadFromRemoteRepo load artifacts from the archivist Repositories stored in a local folder or on git. Both of them take md5hash as a parameter, which is a result of saveToRepo function. For each artifact, md5hash is a unique string of length 32 that is produced by digest function, which uses a cryptographical MD5 hash algorithm. For more information see md5hash.

Important: instead of giving the whole md5hash character, the user can simply give first few characters of the md5hash. For example, a09dd instead of a09ddjdkf9kj33dcjdnfjgos9jd9jkcv. All artifacts with the same md5hash abbreviation will be loaded from Repository.

Note that user and repo should be used only when working with a git repository and should be omitted in the local mode. repoDir should only be used when working on a local Repository and should be omitted in the git mode.

One may notice that loadFromRemoteRepo and loadFromLocalRepo load artifacts to the Global Environment with their original names. Alternatively, a parameter value = TRUE can be specified so that these functions may return artifacts as a value. As a result loaded artifacts can be attributed to new names. Note that, when an abbreviation of md5hash was given then a list of artifacts corresponding to this abbreviation will be loaded.


You can specify one md5hash (or its abbreviation) per function call.

If repo and user are set to NULL (as default) in Remote mode then global parameters set in setRemoteRepo function are used.

You should remember while using loadFromRepo wrapper that repoDir is a parameter used only in loadFromLocalRepo while repo, user, branch and subdir are used only in loadFromRemoteRepo. When you mix those parameters you will receive an error message.


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


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, ahistory, alink, aoptions, archivist-package, areadLocal, aread, asearchLocal, asearch, asession, atrace, cache, copyLocalRepo, createLocalRepo, createMDGallery, deleteLocalRepo, getRemoteHook, getTagsLocal, md5hash, removeTagsRepo, restoreLibs, rmFromLocalRepo, saveToLocalRepo, searchInLocalRepo, setLocalRepo, shinySearchInLocalRepo, showLocalRepo, splitTagsLocal, summaryLocalRepo, zipLocalRepo

  • loadFromLocalRepo
  • loadFromRemoteRepo
# }
# objects preparation

#' exampleRepoDir <- tempfile()
createLocalRepo(repoDir = exampleRepoDir)
saveToLocalRepo(iris, repoDir=exampleRepoDir, archiveSessionInfo = TRUE)
showLocalRepo(method = "md5hashes", repoDir = exampleRepoDir)
showLocalRepo(method = "tags", repoDir = exampleRepoDir)

loadFromLocalRepo(md5hash = '7f3453331910e3f321ef97d87adb5bad',
  repoDir = system.file("graphGallery", package = "archivist"), value = TRUE) -> pl
deleteLocalRepo(exampleRepoDir, TRUE)

#Remote Version

# check the state of the Repository
summaryRemoteRepo( user="pbiecek", repo="archivist" )
showRemoteRepo( user="pbiecek", repo="archivist" )
showRemoteRepo( user="pbiecek", repo="archivist", method = "tags" )

rm( model )
rm( myplot123 )
rm( qda1 )
(VARmd5hash <- searchInRemoteRepo( "varname:Sepal.Width", 
                   user="pbiecek", repo="archivist" ))
(NAMEmd5hash <- searchInRemoteRepo( "name:qda1", 
                   user="pbiecek", repo="archivist", branch="master" ))
(CLASSmd5hash <- searchInRemoteRepo( "class:ggplot", 
                   user="pbiecek", repo="archivist", branch="master" ))

loadFromRemoteRepo( "ff575c261c", user="pbiecek", repo="archivist")
NewObjects <- loadFromRemoteRepo( NAMEmd5hash, user="pbiecek", repo="archivist", value = TRUE )
loadFromRemoteRepo( CLASSmd5hash, user="pbiecek", repo="archivist")

## Loading artifacts from the repository which is built in the archivist package 
## and saving them on the example repository

# Creating an example Repository - on which artifacts loaded from the
# archivist package repository will be saved
exampleRepoDir <- tempfile()
createLocalRepo(repoDir = exampleRepoDir)

# Directory of the archivist package repository
repo_archivist <- system.file("graphGallery", package = "archivist") 

# We are checking what kind of objects
# are stored in the archivist package repository
summaryLocalRepo(repoDir = repo_archivist)

# Let's say that we are interested in 
# an artifact of class ggplot.
GGPLOTmd5hash <- searchInLocalRepo(pattern = "class:ggplot",
                                   repoDir = repo_archivist) 
# There are eight of them.
# We load the first one by its value (parameter value = TRUE)
# and assign it to the p variable.
p <- loadFromLocalRepo(GGPLOTmd5hash[1], repoDir = repo_archivist,
                       value = TRUE)

# Finally, we may save the artifact on the example Repository.
# Note that md5hash is different from the one which is stored in
# the archivist package repository.
saveToRepo(p, repoDir = exampleRepoDir) 

# Making sure that the artifact is stored on the example repository
showLocalRepo(repoDir = exampleRepoDir, method = "tags")

# removing an example Repository

deleteLocalRepo( exampleRepoDir, TRUE)

rm( exampleRepoDir )

# many archivist-like Repositories on one Remote repository

loadFromRemoteRepo( "ff575c261c949d073b2895b05d1097c3", 
user="MarcinKosinski", repo="Museum", branch="master", subdir="ex2")

loadFromRemoteRepo( "ff575c261c949d073b2895b05d1097c3", 
                    user="MarcinKosinski", repo="Museum", branch="master",
loadFromRemoteRepo(md5hash = "08dc0b66975cded92b5cd8291ebdc955", 
               repo = "graphGallery", user = "pbiecek", 
               repoType = "github", value = TRUE)
loadFromRemoteRepo(md5hash = "08dc0b66975cded92b5cd8291ebdc955", 
               repo = "graphGalleryGit", user = "pbiecek", 
               repoType = "bitbucket", value = TRUE)

# mercurial               
loadFromRemoteRepo(md5hash = "08dc0b66975cded92b5cd8291ebdc955", 
               repo = "graphGalleryM", user = "pbiecek", 
               repoType = "bitbucket", value = TRUE)
# }
Documentation reproduced from package archivist, version 2.3.2, License: GPL-2

Community examples

Looks like there are no examples yet.