0th

Percentile

##### 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.

##### Usage
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)
##### Arguments
md5hash

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

repoDir

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

value

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).

repo

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.

user

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.

branch

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.

subdir

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.

repoType

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

##### Details

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.

##### Note

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.

##### Contact

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

##### 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

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

##### Examples
# NOT RUN {
# }
# NOT RUN {
# objects preparation

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

repoDir = system.file("graphGallery", package = "archivist"), value = TRUE) -> pl
deleteLocalRepo(exampleRepoDir, TRUE)
rm(exampleRepoDir)

#
#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" ))

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

## 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

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

user="MarcinKosinski", repo="Museum", branch="master",
subdir="ex1")

#github
repo = "graphGallery", user = "pbiecek",
repoType = "github", value = TRUE)

#git
repo = "graphGalleryGit", user = "pbiecek",
repoType = "bitbucket", value = TRUE)

# mercurial