Learn R Programming

archivist (version 2.3.8)

addTagsRepo: Add new Tags to the Existing Repository

Description

addTagsRepo adds new Tags to the existing Repository.

Usage

addTagsRepo(md5hashes, repoDir = NULL, FUN = NULL, tags = NULL, ...)

Arguments

md5hashes

a character vector of md5hashes specifying to which corresponding artifacts new Tags should be added. See Note to get to know about the length of tags and md5hashes parameters.

repoDir

A character that specifies the directory of the Repository to which new Tags will be added. If it is set to NULL (by default), it uses the repoDir specified in setLocalRepo.

FUN

A function which is evaluated on the artifacts for which md5hashes are given. The result of this function evaluation are Tags which will be added to the local Repository.

tags

A character vector which specifies what kind of Tags should be added to artifacts corresponding to given md5hashes. See Note to get to know about the length of tags and md5hashes parameters. One can specify either FUN or tags.

...

Other arguments that will be passed to FUN.

Contact

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

Author

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

Details

addTagsRepo function adds new Tags to artifacts that are already stored in the repository. One can add new Tags either explicitly with tags parameter or by passing a function which extracts Tags from selected artifacts corresponding to md5hashes. To learn more about artifacts visit archivistPackage.

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

Examples

Run this code
if (FALSE) {

## We Take all artifacts of lm class from repository, 
## extract R^2 for them and store as R^2:number Tags

# Creating empty repository
exampleRepoDir <- tempfile()
createLocalRepo(exampleRepoDir, force=TRUE)

# Saving lm artifacts into repository
m1 <- lm(Sepal.Length~Species, iris)
saveToLocalRepo(m1, exampleRepoDir)
m2 <- lm(Sepal.Width~Species, iris)
saveToLocalRepo(m2, exampleRepoDir)

# We may see what kind of Tags are related to "m1" artifact corresponding to
# "9e66edd297c2f291446f3503c01d443a" md5hash
getTagsLocal("9e66edd297c2f291446f3503c01d443a", exampleRepoDir, "")

# We may see what kind of Tags are related to "m2" artifact corresponding to
# "da1bcaf68752c146903f700c1a458438" md5hash
getTagsLocal("da1bcaf68752c146903f700c1a458438", exampleRepoDir, "")

# We Take all objects of lm class from repository
md5hashes <- searchInLocalRepo(repoDir=exampleRepoDir, "class:lm")

# Adding new tag "test" explicitly
addTagsRepo(md5hashes, exampleRepoDir, tags = "test")

# Adding new tag "R^2: " using FUN parameter
addTagsRepo(md5hashes, exampleRepoDir, function(x) paste0("R^2:",summary(x)$r.square))

# And now: Tags related to "m1" artifact are
getTagsLocal("9e66edd297c2f291446f3503c01d443a", exampleRepoDir, "")

# And now: Tags related to "m2" artifact are
getTagsLocal("da1bcaf68752c146903f700c1a458438", exampleRepoDir, "")

# One more look at our Repo
showLocalRepo(exampleRepoDir, method = "tags")

# Deleting example repository
deleteLocalRepo(exampleRepoDir, deleteRoot=TRUE)
rm(exampleRepoDir)
}

Run the code above in your browser using DataLab