setLocalRepo sets local Repository's global path. setRemoteRepo similarly sets Remote Repository's path. See examples.

setLocalRepo(repoDir)

setPostgresRepo(repoDir, connector = NULL)

setRemoteRepo(user, repo, branch = "master", subdir = "/",
  repoType = "github")

Arguments

repoDir

A character denoting a directory of a Repository that we want to make dafault.

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 examples for createLocalRepo for some applications. If connector=NULL then information about connectors to an external database will be removed. Note that it's an experimental feature.

user

While working with the Remote repository. A character containing a name of the Remote user that we want to make default.

repo

While working with the Remote repository. A character containing a name of the Remote repository that we want to make default.

branch

While working with the Remote repository. A character containing a name of the Remote Repository's branch that we want to make default. Default branch is master.

subdir

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

repoType

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

Details

If you are working on a local Repository and you are tired of specifying repoDir parameter in every function call that uses this parameter, you can set Repository's path globally using setLocalRepo function and omit repoDir parameter in future function calls.

If you are working on the Remote Repository and you are tired of specifying user, repo, branch and subdir parameters in every function call that uses these parameters, you can set Remote Repository's path globally using setRemoteRepo function and omit user, repo, branch and subdir parameters in future function calls. See examples.

For local repositories, in this way, in the following function calls: loadFromLocalRepo,searchInLocalRepo, rmFromLocalRepo, zipLocalRepo, addTagsRepo, shinySearchInLocalRepo, getTagsLocal, showLocalRepo, summaryLocalRepo repoDir parameter may be omitted. For remote repositories, in this way, in the following function calls: zipRemoteRepo, loadFromRemoteRepo, searchInRemoteRepo, getTagsRemote, showRemoteRepo, summaryRemoteRepo, copyRemoteRepo parameters user, repo, branch, subdir may be omitted.

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

See also

Examples

# NOT RUN {
## Local version
exampleRepoDir <- tempfile()
createLocalRepo(repoDir = exampleRepoDir)
setLocalRepo(exampleRepoDir)

data(iris)
data(swiss)

# From this moment repoDir parameter may be ommitted in the following functions
saveToRepo(iris)
saveToRepo(swiss)
showLocalRepo()
showLocalRepo(method = "tags")
iris2 <- loadFromLocalRepo( "ff575c2" , value = TRUE)
searchInLocalRepo("name:i", fixed = FALSE)
getTagsLocal("ff575c261c949d073b2895b05d1097c3")
rmFromLocalRepo("4c43f")
showLocalRepo()
summaryLocalRepo()

# REMEMBER that in deleteLocalRepo you MUST specify repoDir parameter!
# deleteRepo doesn't take setLocalRepo's settings into consideration
deleteLocalRepo( exampleRepoDir, deleteRoot=TRUE)
rm( exampleRepoDir )

## Github version
setRemoteRepo( user="MarcinKosinski", repo="Museum", branch="master",
               subdir="ex1" )

# From this moment user, repo, branch, subdir parameters may be ommitted
# in the following functions:
showRemoteRepo()
loadFromRemoteRepo( "ff575c261c949d073b2895b05d1097c3")
this <- loadFromRemoteRepo( "ff", value = TRUE)
zipRemoteRepo()
file.remove(file.path(getwd(), "repository.zip")) # We can remove this zip file
searchInRemoteRepo( "name:", fixed= FALSE)
getTagsRemote("ff575c261c949d073b2895b05d1097c3")
summaryRemoteRepo( )

# To use multisearchInRemoteRepo we should use repository with more than one artifact. 
setRemoteRepo( user="pbiecek", repo="archivist"  )

# From this moment user and repo parameters may be ommitted in the following functions
showRemoteRepo()
searchInRemoteRepo( pattern=c("varname:Sepal.Width", "class:lm", "name:myplot123"),
                         intersect = FALSE )
# }