if (FALSE) {
## Using archivist remote Repository to copy artifacts
# creating example Repository
exampleRepoDir <- tempfile()
createLocalRepo( exampleRepoDir )
# Searching for md5hashes of artifacts (without data related to them)
# in the archivist remote Repository
hashes <- searchInRemoteRepo( pattern="name", user="pbiecek", repo="archivist", fixed=FALSE )
# Copying selected artifacts from archivist Remote Repository into exampleRepoDir Repository
copyRemoteRepo( repoTo = exampleRepoDir , md5hashes= hashes, user="pbiecek", repo="archivist" )
# See how the gallery folder in our exampleRepoDir Repository
# with copies of artifacts from archivist Remote Repository looks like
list.files( path = file.path( exampleRepoDir, "gallery" ) )
# See how the backpack database in our exampleRepoDir Repository looks like
showLocalRepo( repoDir = exampleRepoDir )
# removing an example Repository
deleteLocalRepo( exampleRepoDir, deleteRoot=TRUE )
rm( exampleRepoDir )
# many archivist-like Repositories on one Remote repository
dir <- paste0(getwd(), "/ex1")
createLocalRepo( dir )
copyRemoteRepo( repoTo = dir , md5hashes = "ff575c261c949d073b2895b05d1097c3",
user="MarcinKosinski", repo="Museum",
branch="master", subdir="ex2")
# Check if the copied artifact is on our dir Repository
showLocalRepo( repoDir = dir) # It is in backpack database indeed
list.files( path = file.path( dir, "gallery" ) ) # it is also in gallery folder
# removing an example Repository
deleteLocalRepo( dir, TRUE)
rm(dir)
## Using graphGallery Repository attached to the archivist package to copy artifacts
# creating example Repository
exampleRepoDir <- tempfile()
createLocalRepo( exampleRepoDir )
# Searching for md5hashes of artifacts (without data related to them)
# in the graphGallery Repository
archivistRepo <- system.file( "graphGallery", package = "archivist")
# You may use:
# hashes <- unique(showLocalRepo(repoDir)[,1])
# to extract all artifacts from repository
hashes <- searchInLocalRepo( pattern="name",
repoDir = archivistRepo,
fixed=FALSE )
# Copying selected artifacts from archivist Remote Repository into exampleRepoDir Repository
copyLocalRepo( repoFrom = archivistRepo, repoTo = exampleRepoDir , md5hashes= hashes )
# See how the backpack database in our exampleRepoDir Repository looks like
showLocalRepo( repoDir = exampleRepoDir )
# removing an example Repository
deleteLocalRepo( exampleRepoDir, deleteRoot=TRUE )
rm( exampleRepoDir )
rm( archivistRepo )
}
Run the code above in your browser using DataLab