Read Artifacts Given as a List of Tags

Share:

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

1
asearch(patterns, repo = NULL)

Arguments

patterns

A character vector of Tags. Only artifacts that contain all Tags are returned.

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).

Note

Remember that if you want to use local repository you should set it to default.

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

Author(s)

Przemyslaw Biecek, przemyslaw.biecek@gmail.com

See Also

Other archivist: Repository, Tags, %a%, addHooksToPrint, addTagsRepo, aformat, ahistory, alink, aoptions, archivist-package, aread, asession, atrace, cache, copyLocalRepo, createLocalRepo, createMDGallery, deleteLocalRepo, getRemoteHook, getTagsLocal, loadFromLocalRepo, md5hash, restoreLibs, rmFromLocalRepo, saveToLocalRepo, searchInLocalRepo, setLocalRepo, shinySearchInLocalRepo, showLocalRepo, splitTagsLocal, summaryLocalRepo, zipLocalRepo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
## 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/f05f0ed0662fe01850ec1b928830ef32") .
# 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.