Learn R Programming

archivist (version 2.3.8)

searchInLocalRepo: Search for an Artifact in the Repository Using Tags

Description

searchInRepo searches for an artifact in the Repository using it's Tags. To learn more about artifacts visit archivistPackage.

Usage

searchInLocalRepo(
  pattern,
  repoDir = aoptions("repoDir"),
  fixed = TRUE,
  intersect = TRUE
)

searchInRemoteRepo( pattern, repo = aoptions("repo"), user = aoptions("user"), branch = "master", subdir = aoptions("subdir"), repoType = aoptions("repoType"), fixed = TRUE, intersect = TRUE )

multiSearchInLocalRepo(...)

multiSearchInRemoteRepo(...)

Value

searchInRepo returns character vector of md5hashes of artifacts that were searched for. Those are hashes assigned to artifacts while they were saved in the Repository by the saveToLocalRepo function. If the artifact is not in the Repository then a logical value FALSE is returned.

Arguments

pattern

If fixed = TRUE: a character denoting a Tag which is to be searched for in the Repository. It is also possible to specify pattern as a list of length 2 with dateFrom and dateTo; see details. If fixed = FALSE: a regular expression specifying the beginning of a Tag, which will be used to search for artifacts. If of length more than one and if intersect = TRUE then artifacts that match all conditions are returned. If intersect = FALSE then artifacts that match any condition are returned. See examples.

repoDir

A character denoting an existing directory in which artifacts will be searched for.

fixed

A logical value specifying how artifacts should be searched for. If fixed = TRUE (default) then artifacts are searched for by using pattern = "Tag" argument. If fixed = FALSE then artifacts are searched for by using pattern = "regular expression" argument. The latter is wider and more flexible method, e.g., using pattern = "name", fixed = FALSE arguments enables to search for all artifacts in the Repository.

intersect

A logical value. Used only when length(pattern) > 1 & is.character(pattern). See pattern for more details.

repo

While working with the Remote repository. A character containing a name of the Remote repository on which the Repository is stored. By default set to NULL - see Note.

user

While working with the Remote repository. A character containing a name of the Remote user on whose account the repo is created. By default set to NULL - see Note.

branch

While working with the Remote repository. A character containing a name of the Remote Repository's branch on which the Repository is stored. Default branch is master.

subdir

While working with the Remote repository. A character containing a name of a directory on the Remote repository on which the Repository is stored. If the Repository is stored in the main folder of 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'.

...

Used for old deprecated functions.

Contact

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

Author

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

Details

searchInRepo searches for an artifact in the Repository using it's Tag (e.g., name, class or archiving date). Tags are used in a pattern parameter. For various artifact classes different Tags can be searched for. See Tags. If a pattern is a list of length 2 then md5hashes of all artifacts created from date dateFrom to date dateTo are returned. The date should be formatted according to the YYYY-MM-DD format, e.g., "2014-07-31".

Tags, used in a pattern parameter, should be determined according to the format: "TagKey:TagValue" - see examples.

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

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

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

Examples

Run this code
if (FALSE) {
# objects preparation

  showLocalRepo(method = "md5hashes", 
     repoDir = system.file("graphGallery", package = "archivist"))
  showLocalRepo(method = "tags", 
     repoDir = system.file("graphGallery", package = "archivist"))
  
  # Tag search, fixed version
  searchInLocalRepo( "class:ggplot", repoDir = exampleRepoDir )
  searchInLocalRepo( "name:", repoDir = exampleRepoDir )
  # Tag search, regex version
  searchInLocalRepo( "class", repoDir = exampleRepoDir, fixed = FALSE )
  
  # Github version
  # check the state of the Repository
  summaryRemoteRepo( user="pbiecek", repo="archivist" )
  showRemoteRepo( user="pbiecek", repo="archivist" )
  showRemoteRepo( user="pbiecek", repo="archivist", method = "tags" )
  # Tag search, fixed version
  searchInRemoteRepo( "varname:Sepal.Width", user="pbiecek", repo="archivist" )
  searchInRemoteRepo( "class:lm", user="pbiecek", repo="archivist", branch="master" )
  searchInRemoteRepo( "name:myplot123", user="pbiecek", repo="archivist" )
  
  # Tag search, regex version
  searchInRemoteRepo( "class", user="pbiecek", repo="archivist",  fixed = FALSE )
  searchInRemoteRepo( "name", user="pbiecek", repo="archivist", fixed = FALSE )
  
  # also on Github
  
  # Remeber to set dateTo parameter to actual date because sometimes we update datasets.
  searchInRemoteRepo( pattern = list( dateFrom = "2015-10-01", dateTo = "2015-11-30" ), 
                      user="pbiecek", repo="archivist", branch="master" )
  
  
  # many archivist-like Repositories on one Remote repository
  
  searchInRemoteRepo( pattern = "name", user="MarcinKosinski", repo="Museum", 
  branch="master", subdir="ex1", fixed = FALSE )

  searchInRemoteRepo( pattern = "name", user="MarcinKosinski", repo="Museum", 
                   branch="master", subdir="ex2", fixed = FALSE )
 
 # multi versions
 searchInRemoteRepo( pattern=c("varname:Sepal.Width", "class:lm", "name:myplot123"), 
                         user="pbiecek", repo="archivist", intersect = FALSE )
  
}

Run the code above in your browser using DataLab