createLocalRepo {archivist}R Documentation

Create an Empty Repository

Description

createLocalRepo creates an empty Repository in the given directory in which archived artifacts will be stored.

Usage

createLocalRepo(repoDir, force = FALSE, default = FALSE)

createPostgresRepo(repoDir, connector, force = FALSE, default = FALSE)

createEmptyRepo(...)

Arguments

repoDir

A character that specifies the directory for the Repository which is to be made.

force

If force = TRUE and repoDir parameter specifies the directory that contains backpack.db file, then function call will force to recreate new backpack.db Default set to force = FALSE.

default

If default = TRUE then repoDir is set as default Local Repository.

connector

If user want to use some external database instead of SQLite, then the connector shall be the function that create a DBI connection with the database. Within every transaction the connection is opened and closed, thus the connector function will be executed often and shall not be computationally heavy. See the Examples section for some examples. Note that it's an experimental feature.

...

All arguments are being passed to createLocalRepo.

Details

At least one Repository must be initialized before using other functions from the archivist package. While working in groups, it is highly recommended to create a Repository on a shared Dropbox/GitHub folder.

All artifacts which are desired to be archived are going to be saved in the local Repository, which is an SQLite database stored in a file named backpack. After calling saveToRepo function, each artifact will be archived in a md5hash.rda file. This file will be saved in a folder (under repoDir directory) named gallery. For every artifact, md5hash is a unique string of length 32 that is produced by digest function, which uses a cryptographical MD5 hash algorithm.

To learn more about artifacts visit archivist-package.

Created backpack database is a useful and fundamental tool for remembering artifact's name, class, archiving date etc. (the so called Tags) or for keeping artifact's md5hash.

Besides the backpack database, gallery folder is created in which all artifacts will be archived.

After every saveToRepo call the database is refreshed. As a result, the artifact is available immediately in backpack.db database for other collaborators.

Contact

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

Author(s)

Marcin Kosinski, m.p.kosinski@gmail.com Przemyslaw Biecek, przemyslaw.biecek@gmail.com

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

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

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

Examples

## Not run: 
exampleRepoDir <- tempfile()
createLocalRepo( repoDir = exampleRepoDir, default =  TRUE )
data(iris)
saveToLocalRepo(iris)
showLocalRepo()
showLocalRepo(method = "tags")
deleteLocalRepo( repoDir = exampleRepoDir, unset = TRUE, deleteRoot = TRUE)

# example with external database
# create a connector
require("RPostgreSQL")
drv <- dbDriver("PostgreSQL")
connector <- function() {
  dbConnect(drv, dbname = "postgres",
            host = "localhost", port = 5432,
            user = "user", password = pw)
}
# Now you can create an empty repository with postgress database
exampleRepoDir <- tempfile()
createPostgresRepo( repoDir = exampleRepoDir, connector)
data(iris)
saveToLocalRepo(iris)
showLocalRepo()
showLocalRepo(method = "tags")
deleteLocalRepo( repoDir = exampleRepoDir, unset = TRUE, deleteRoot = TRUE)


## End(Not run)

[Package archivist version 2.3.6 Index]