Skip to content

Commit fa2b524

Browse files
committed
Update README for a few other functions and common activities.
Including the preferred way to locate batons to allow filtering by types of relays (e.g. practice vs competition). Update LOCKFILE as additional packages were needed for making the RMD file again.
1 parent 722f908 commit fa2b524

File tree

3 files changed

+200
-20
lines changed

3 files changed

+200
-20
lines changed

README.Rmd

+43-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Grab the baton from the initial process, and perform a checkpoint before proceed
6969
```{r eval = FALSE}
7070
# Grab baton
7171
work_loc <- '/my/fav/loc'
72-
my_baton <- grab_baton(loc = file.path(work_loc, list.files(raw_loc, pattern = '^_baton-\\.*')[1])
72+
my_baton <- grab_baton(loc = file.path(work_loc, locate_batons(work_loc)[1])
7373
7474
7575
# Perform checks to determine what following steps are performed
@@ -104,3 +104,45 @@ my_baton <- pass_baton(my_baton)
104104
plot(my_baton)
105105
```
106106

107+
## Locate batons
108+
109+
As a workflow grows, it may become more difficult to find where they are in the R environment or on the file system. It is recommended to use `locate_batons()` for this purpose. This also allows the user to define which **relay_type** to search for. This could be important if you have a mix of testing batons mixed in with ones being actively used.
110+
111+
```{r, eval = FALSE}
112+
# Location on file system that has baton objects saved
113+
work_loc <- '/my/fav/loc'
114+
115+
# Get list from location of interest, exclude all test batons
116+
baton_2_load <- locate_batons(work_loc, relay_type = 'COMPETITION')
117+
118+
# Examine information, slice top
119+
baton_2_load_info <- file.info(baton_2_load)
120+
baton_2_load <- baton_2_load[1]
121+
122+
# Load the baton of interest
123+
my_baton <- grab_baton(loc = baton_2_load)
124+
```
125+
126+
## Examine baton
127+
128+
There are several helper functions to make it easier to examine contents of a baton, either within the R session or through the connection to the persistent YAML file.
129+
130+
```{r, eval = FALSE}
131+
# Within R session
132+
read_metadata(my_baton, subset = c('pass_complete', 'relay_type', 'relay_start', 'relay_finish'))
133+
134+
# If from YAML
135+
read_metadata(loc = 'path/to/baton.yml')
136+
```
137+
138+
```{r, echo = FALSE, warning = FALSE, message = FALSE}
139+
read_metadata(my_baton, subset = c('pass_complete', 'relay_type', 'relay_start', 'relay_finish'))
140+
```
141+
142+
For functions such as `summary` and `plot`, one may not want to load the baton directly. However, since these functions require a specific class to operate, one can not simply just read the YAML file. Instead, we can use the `preview_baton()` constructor and pass this to the appropriate generics.
143+
144+
```{r, eval = FALSE}
145+
plot(preview_baton('path/to/baton.yml'))
146+
summary(preview_baton('path/to/baton.yml'))
147+
```
148+

README.md

+70-10
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ For more complex workflows, one method is to create *bundled* content
6161
that passes through *checkpoints*. Several helper-functions in {relay}
6262
assist in this approach. Building from the prior example, one may start
6363
with a folder that serves as a staging area for all of a workflows
64-
dependent data; let us call this the *\\raw* folder. A *baton* tracks
65-
content that should exist in *\\raw*. A downstream process responsible
66-
for processing will leverage *\\raw* and its *baton*, let us call this
67-
folder *\\bundle-raw*. We create this folder with a helper function
64+
dependent data; let us call this the *\raw* folder. A *baton* tracks
65+
content that should exist in *\raw*. A downstream process responsible
66+
for processing will leverage *\raw* and its *baton*, let us call this
67+
folder *\bundle-raw*. We create this folder with a helper function
6868
`create_bundle()`, or manually if preferred, perhaps containing a new
69-
sub-folder called *.\\processed* and another called *.\\raw* which is a
70-
copy of content from the original *\\raw*. The *baton* associated with
69+
sub-folder called *.\processed* and another called *.\raw* which is a
70+
copy of content from the original *\raw*. The *baton* associated with
7171
the data queries can be grabbed for inspection. Based upon the metadata
7272
and content of the *baton*, the processing step may halt or proceed, the
7373
conditions of success are up to you. However, if the *baton* was never
@@ -115,9 +115,9 @@ remotes::install_github('al-obrien/relay')
115115

116116
### First Process
117117

118-
Create the baton, and after the workflow process, the baton\_content
119-
will check to see if specific datasets are present and the time they
120-
were created when the baton was in the relay.
118+
Create the baton, and after the workflow process, the baton_content will
119+
check to see if specific datasets are present and the time they were
120+
created when the baton was in the relay.
121121

122122
``` r
123123
# Load
@@ -157,7 +157,7 @@ determine specific types of output to be generated if the check fails.
157157
``` r
158158
# Grab baton
159159
work_loc <- '/my/fav/loc'
160-
my_baton <- grab_baton(loc = file.path(work_loc, list.files(raw_loc, pattern = '^_baton-\\.*')[1])
160+
my_baton <- grab_baton(loc = file.path(work_loc, locate_batons(work_loc)[1])
161161

162162

163163
# Perform checks to determine what following steps are performed
@@ -178,3 +178,63 @@ plot(my_baton)
178178
```
179179

180180
<img src="README_files/figure-gfm/unnamed-chunk-5-1.png" width="100%" />
181+
182+
## Locate batons
183+
184+
As a workflow grows, it may become more difficult to find where they are
185+
in the R environment or on the file system. It is recommended to use
186+
`locate_batons()` for this purpose. This also allows the user to define
187+
which **relay_type** to search for. This could be important if you have
188+
a mix of testing batons mixed in with ones being actively used.
189+
190+
``` r
191+
# Location on file system that has baton objects saved
192+
work_loc <- '/my/fav/loc'
193+
194+
# Get list from location of interest, exclude all test batons
195+
baton_2_load <- locate_batons(work_loc, relay_type = 'COMPETITION')
196+
197+
# Examine information, slice top
198+
baton_2_load_info <- file.info(baton_2_load)
199+
baton_2_load <- baton_2_load[1]
200+
201+
# Load the baton of interest
202+
my_baton <- grab_baton(loc = baton_2_load)
203+
```
204+
205+
## Examine baton
206+
207+
There are several helper functions to make it easier to examine contents
208+
of a baton, either within the R session or through the connection to the
209+
persistent YAML file.
210+
211+
``` r
212+
# Within R session
213+
read_metadata(my_baton, subset = c('pass_complete', 'relay_type', 'relay_start', 'relay_finish'))
214+
215+
# If from YAML
216+
read_metadata(loc = 'path/to/baton.yml')
217+
```
218+
219+
## $pass_complete
220+
## [1] TRUE
221+
##
222+
## $relay_type
223+
## [1] "COMPETITION"
224+
##
225+
## $relay_start
226+
## [1] "2023-04-28 15-13-26"
227+
##
228+
## $relay_finish
229+
## [1] "2023-04-28 15-13-33"
230+
231+
For functions such as `summary` and `plot`, one may not want to load the
232+
baton directly. However, since these functions require a specific class
233+
to operate, one can not simply just read the YAML file. Instead, we can
234+
use the `preview_baton()` constructor and pass this to the appropriate
235+
generics.
236+
237+
``` r
238+
plot(preview_baton('path/to/baton.yml'))
239+
summary(preview_baton('path/to/baton.yml'))
240+
```

renv.lock

+87-9
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,76 @@
99
]
1010
},
1111
"Packages": {
12+
"R6": {
13+
"Package": "R6",
14+
"Version": "2.5.0",
15+
"Source": "Repository",
16+
"Repository": "CRAN",
17+
"Hash": "b203113193e70978a696b2809525649d"
18+
},
1219
"base64enc": {
1320
"Package": "base64enc",
1421
"Version": "0.1-3",
1522
"Source": "Repository",
1623
"Repository": "CRAN",
1724
"Hash": "543776ae6848fde2f48ff3816d0628bc"
1825
},
26+
"bslib": {
27+
"Package": "bslib",
28+
"Version": "0.4.2",
29+
"Source": "Repository",
30+
"Repository": "RSPM",
31+
"Hash": "a7fbf03946ad741129dc81098722fca1"
32+
},
33+
"cachem": {
34+
"Package": "cachem",
35+
"Version": "1.0.5",
36+
"Source": "Repository",
37+
"Repository": "RSPM",
38+
"Hash": "5346f76a33eb7417812c270b04a5581b"
39+
},
1940
"digest": {
2041
"Package": "digest",
2142
"Version": "0.6.27",
2243
"Source": "Repository",
2344
"Repository": "CRAN",
2445
"Hash": "a0cbe758a531d054b537d16dff4d58a1"
2546
},
47+
"ellipsis": {
48+
"Package": "ellipsis",
49+
"Version": "0.3.2",
50+
"Source": "Repository",
51+
"Repository": "CRAN",
52+
"Hash": "bb0eec2fe32e88d9e2836c2f73ea2077"
53+
},
2654
"evaluate": {
2755
"Package": "evaluate",
2856
"Version": "0.14",
2957
"Source": "Repository",
3058
"Repository": "CRAN",
3159
"Hash": "ec8ca05cffcc70569eaaad8469d2a3a7"
3260
},
61+
"fastmap": {
62+
"Package": "fastmap",
63+
"Version": "1.1.0",
64+
"Source": "Repository",
65+
"Repository": "RSPM",
66+
"Hash": "77bd60a6157420d4ffa93b27cf6a58b8"
67+
},
68+
"fontawesome": {
69+
"Package": "fontawesome",
70+
"Version": "0.5.1",
71+
"Source": "Repository",
72+
"Repository": "RSPM",
73+
"Hash": "1e22b8cabbad1eae951a75e9f8b52378"
74+
},
75+
"fs": {
76+
"Package": "fs",
77+
"Version": "1.5.0",
78+
"Source": "Repository",
79+
"Repository": "RSPM",
80+
"Hash": "44594a07a42e5f91fac9f93fda6d0109"
81+
},
3382
"glue": {
3483
"Package": "glue",
3584
"Version": "1.4.2",
@@ -46,10 +95,17 @@
4695
},
4796
"htmltools": {
4897
"Package": "htmltools",
49-
"Version": "0.5.1.1",
98+
"Version": "0.5.5",
99+
"Source": "Repository",
100+
"Repository": "RSPM",
101+
"Hash": "ba0240784ad50a62165058a27459304a"
102+
},
103+
"jquerylib": {
104+
"Package": "jquerylib",
105+
"Version": "0.1.4",
50106
"Source": "Repository",
51107
"Repository": "CRAN",
52-
"Hash": "af2c2531e55df5cf230c4b5444fc973c"
108+
"Hash": "5aab57a3bd297eee1c1d862735972182"
53109
},
54110
"jsonlite": {
55111
"Package": "jsonlite",
@@ -79,6 +135,13 @@
79135
"Repository": "CRAN",
80136
"Hash": "61e4a10781dd00d7d81dd06ca9b94e95"
81137
},
138+
"memoise": {
139+
"Package": "memoise",
140+
"Version": "2.0.1",
141+
"Source": "Repository",
142+
"Repository": "CRAN",
143+
"Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c"
144+
},
82145
"mime": {
83146
"Package": "mime",
84147
"Version": "0.10",
@@ -93,25 +156,40 @@
93156
"Repository": "CRAN",
94157
"Hash": "97def703420c8ab10d8f0e6c72101e02"
95158
},
159+
"rappdirs": {
160+
"Package": "rappdirs",
161+
"Version": "0.3.3",
162+
"Source": "Repository",
163+
"Repository": "RSPM",
164+
"Hash": "5e3c5dc0b071b21fa128676560dbe94d"
165+
},
96166
"renv": {
97167
"Package": "renv",
98168
"Version": "0.13.2",
99169
"Source": "Repository",
100-
"Repository": "CRAN"
170+
"Repository": "RSPM",
171+
"Hash": "079cb1f03ff972b30401ed05623cbe92"
101172
},
102173
"rlang": {
103174
"Package": "rlang",
104-
"Version": "0.4.11",
175+
"Version": "1.1.0",
105176
"Source": "Repository",
106177
"Repository": "CRAN",
107-
"Hash": "515f341d3affe0de9e4a7f762efb0456"
178+
"Hash": "dc079ccd156cde8647360f473c1fa718"
108179
},
109180
"rmarkdown": {
110181
"Package": "rmarkdown",
111-
"Version": "2.9",
182+
"Version": "2.21",
112183
"Source": "Repository",
113184
"Repository": "CRAN",
114-
"Hash": "912c09266d5470516df4df7a303cde92"
185+
"Hash": "493df4ae51e2e984952ea4d5c75786a3"
186+
},
187+
"sass": {
188+
"Package": "sass",
189+
"Version": "0.4.5",
190+
"Source": "Repository",
191+
"Repository": "RSPM",
192+
"Hash": "2bb4371a4c80115518261866eab6ab11"
115193
},
116194
"stringi": {
117195
"Package": "stringi",
@@ -136,10 +214,10 @@
136214
},
137215
"xfun": {
138216
"Package": "xfun",
139-
"Version": "0.24",
217+
"Version": "0.39",
140218
"Source": "Repository",
141219
"Repository": "CRAN",
142-
"Hash": "88cdb9779a657ad80ad942245fffba31"
220+
"Hash": "8f56e9acb54fb525e66464d57ab58bcb"
143221
},
144222
"yaml": {
145223
"Package": "yaml",

0 commit comments

Comments
 (0)