archive {archivist.github}R Documentation

Archive Artifact to Local and GitHub Repository

Description

archive stores artifacts in the local Repository and automatically pushes archived artifacts to the GitHub Repository with which the local Repository is synchronized (via createGitHubRepo or cloneGitHubRepo). Function stores artifacts on the same way as saveToLocalRepo function.

This function is well explained on this http://r-bloggers.com/r-hero-saves-backup-city-with-archivist-and-github blog post.

Usage

archive(artifact, commitMessage = aoptions("commitMessage"),
  repo = aoptions("repo"), user = aoptions("user"),
  password = aoptions("password"), alink = aoptions("alink"),
  artifactName = deparse(substitute(artifact)), verbose = FALSE, ...)

Arguments

artifact

An artifact to be archived on Local and Github Repository.

commitMessage

A character denoting a message added to the commit while archiving artifact on GitHub Repository. By default, an artifact's md5hash is added to the commit message when it is specified to NULL.

repo

A character denoting GitHub repository name and synchronized local existing directory in which an artifact will be saved.

user

A character denoting GitHub user name. Can be set globally with aoptions("user", user). See agithub.

password

A character denoting GitHub user password. Can be set globally with aoptions("password", password). See agithub.

alink

Logical. Whether the result should be put into alink function. If you would like to pass further arguments to alink then you should specify them with aoptions in this case.

artifactName

The name of the artifact with which it should be archived. If NULL then object's MD5 hash will be used instead.

verbose

A logical value. If TRUE then additional messages will be printed out.

...

Further arguments passed to saveToLocalRepo function.

Details

To learn more about Archivist Integration With GitHub visit agithub.

Note

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

Author(s)

Marcin Kosinski, m.p.kosinski@gmail.com

References

More about archivist.github can be found on marcinkosinski.github.io/archivist.github/ and about archivist in posts' history on https://pbiecek.github.io/archivist/articles/posts.html

See Also

Other archivist.github: archivist.github-package, authoriseGitHub, cloneGitHubRepo, createGitHubRepo, deleteGitHubRepo, pushGitHubRepo

Examples

## Not run: 

# empty GitHub Repository creation
authoriseGitHub(ClientID, ClientSecret) -> github_token
# authoriseGitHub also does: aoptions("github_token", github_token)
aoptions("user", user.name)
aoptions("password", user.password)

createGitHubRepo("archive-test4", default = TRUE)
## artifact's archiving
exampleVec <- 1:100

# archiving
archive(exampleVec) -> md5hash_path

## proof that artifact is really archived
showGithubRepo() # uses options from setGithubRepo
# let's remove exampleVec
rm(exampleVec)
# and load it back from md5hash_path
aread(md5hash_path)


# clone example
unlink("archive-test", recursive = TRUE)
cloneGithubRepo('https://github.com/MarcinKosinski/archive-test')
setRemoteRepo(aoptions("user"), "archive-test")
data(iris)
archive(iris)
showRemoteRepo()

## alink() option
vectorLong <- 1:100
vectorShort <- 1:20
# archiving
alink(archive(vectorLong))
archive(vectorShort, alink = TRUE)
showRemoteRepo()



## End(Not run)

[Package archivist.github version 0.2.6 Index]