asearch {archivist} | R Documentation |
Read Artifacts Given as a List of Tags
Description
asearch
searches for artifacts that contain all specified Tags
and reads all of them from a default or Remote Repository. It's a wrapper around
searchInLocalRepo and loadFromLocalRepo and their Remote versions.
Usage
asearch(patterns, repo = NULL)
Arguments
patterns |
A character vector of |
repo |
One of following: A character with Remote user name and Remote repository name separated by '/'. NULL in this case search will be performed in the default repo, either local or Remote |
Details
Function asearch
reads all artifacts that contain given list of Tags
from default or Remote Repository.
It uses both loadFromLocalRepo and searchInLocalRepo functions (or their Remote versions)
but has shorter name and different parameter's specification.
Value
This function returns a list of artifacts (by their values).
Contact
Bug reports and feature requests can be sent to https://github.com/pbiecek/archivist/issues
Note
Remember that if you want to use local repository you should set it to default.
Author(s)
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()
,
asession()
,
atrace()
,
cache()
,
copyLocalRepo()
,
createLocalRepo()
,
createMDGallery()
,
deleteLocalRepo()
,
getRemoteHook()
,
getTagsLocal()
,
loadFromLocalRepo()
,
md5hash
,
removeTagsRepo()
,
restoreLibs()
,
rmFromLocalRepo()
,
saveToLocalRepo()
,
searchInLocalRepo()
,
setLocalRepo()
,
shinySearchInLocalRepo()
,
showLocalRepo()
,
splitTagsLocal()
,
summaryLocalRepo()
,
zipLocalRepo()
Examples
## Not run:
### default LOCAL version
## objects preparation
# data.frame object
data(iris)
# ggplot/gg object
library(ggplot2)
df <- data.frame(gp = factor(rep(letters[1:3], each = 10)),y = rnorm(30))
library(plyr)
ds <- ddply(df, .(gp), summarise, mean = mean(y), sd = sd(y))
myplot123 <- ggplot(df, aes(x = gp, y = y)) +
geom_point() + geom_point(data = ds, aes(y = mean),
colour = 'red', size = 3)
# lm object
model <- lm(Sepal.Length~ Sepal.Width + Petal.Length + Petal.Width, data= iris)
model2 <- lm(Sepal.Length~ Sepal.Width + Petal.Width, data= iris)
model3 <- lm(Sepal.Length~ Sepal.Width, data= iris)
## creating example default local repository
exampleRepoDir <- tempfile()
createLocalRepo(repoDir = exampleRepoDir)
## setting default local repository
setLocalRepo( repoDir = exampleRepoDir )
saveToLocalRepo(myplot123)
saveToLocalRepo(iris)
saveToLocalRepo(model)
saveToLocalRepo(model2)
saveToLocalRepo(model3)
## Searching for objects of class:lm
lm <- asearch(patterns = "class:lm")
## Searching for objects of class:lm with coefname:Petal.Width
lm_c_PW <- asearch(patterns = c("class:lm","coefname:Petal.Width"))
# Note that we searched for objects. Then loaded them from repository by their value.
## deleting example repository
deleteLocalRepo(repoDir = exampleRepoDir, deleteRoot = TRUE)
rm(exampleRepoDir)
### default GitHub version
## Setting default github repository
setRemoteRepo( user = "pbiecek", repo = "archivist")
showRemoteRepo(method = "tags")$tag
searchInRemoteRepo(pattern = "class:lm")
searchInRemoteRepo(pattern = "class:gg")
getTagsRemote(md5hash = "cd6557c6163a6f9800f308f343e75e72", tag = "")
## Searching for objects of class:lm
asearch(patterns = c("class:lm"))
## Searching for objects of class:gg
ggplot_objects <- asearch(patterns = c("class:gg"))
# names(ggplot_objects)
# To plot them remember to have ggplot2 in version 2.1.0
# as this is stated in asession("pbiecek/archivist/13b2724139eb2c62578b4dab0d7b2cea") or
asession("pbiecek/archivist/7f3453331910e3f321ef97d87adb5bad") .
# The state of R libraries can be restored to the same state in
# which those objects were created with the restoreLibs function.
### Remote version
## Note that repo argument is passed in the following way to asearch:
## repo = "GitHub user name/GitHub repository name"
## Searching for objects of class:gg
asearch("pbiecek/graphGallery",
patterns = c("class:gg",
"labelx:Sepal.Length")) -> ggplots_objects_v2
## End(Not run)