if (FALSE) {
# 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)
loadFromLocalRepo(md5hash = '7f3453331910e3f321ef97d87adb5bad',
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" ))
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",
subdir="ex1")
#github
loadFromRemoteRepo(md5hash = "08dc0b66975cded92b5cd8291ebdc955",
repo = "graphGallery", user = "pbiecek",
repoType = "github", value = TRUE)
#git
loadFromRemoteRepo(md5hash = "08dc0b66975cded92b5cd8291ebdc955",
repo = "graphGalleryGit", user = "pbiecek",
repoType = "bitbucket", value = TRUE)
# mercurial
loadFromRemoteRepo(md5hash = "08dc0b66975cded92b5cd8291ebdc955",
repo = "graphGalleryM", user = "pbiecek",
repoType = "bitbucket", value = TRUE)
}
Run the code above in your browser using DataLab