... | ... |
@@ -35,7 +35,7 @@ Filters the versions based on multiple conditions: their age and status |
35 | 35 |
# creating an example cache record |
36 | 36 |
bioc_url <- 'https://bioconductor.org/' |
37 | 37 |
version <- omnipath_cache_latest_or_new(url = bioc_url) |
38 |
-download.file(bioc_url, destfile = version$path) |
|
38 |
+httr::GET(bioc_url, httr::write_disk(version$path, overwrite = TRUE)) |
|
39 | 39 |
omnipath_cache_download_ready(version) |
40 | 40 |
record <- dplyr::first(omnipath_cache_search('biocond')) |
41 | 41 |
|
... | ... |
@@ -26,7 +26,7 @@ versions with `ready` (completed download) status are selected} |
26 | 26 |
} |
27 | 27 |
\value{ |
28 | 28 |
Character vector with version IDs, NA if no version satisfies the |
29 |
- conditions |
|
29 |
+ conditions. |
|
30 | 30 |
} |
31 | 31 |
\description{ |
32 | 32 |
Filters the versions based on multiple conditions: their age and status |
... | ... |
@@ -40,7 +40,7 @@ omnipath_cache_download_ready(version) |
40 | 40 |
record <- dplyr::first(omnipath_cache_search('biocond')) |
41 | 41 |
|
42 | 42 |
# only the versions with status "ready" |
43 |
-version_numbers <- omnipath_cache_filter_versions(status = 'ready') |
|
43 |
+version_numbers <- omnipath_cache_filter_versions(record, status = 'ready') |
|
44 | 44 |
omnipath_cache_remove(url = bioc_url) # cleaning up |
45 | 45 |
|
46 | 46 |
} |
... | ... |
@@ -32,10 +32,15 @@ Character vector with version IDs, NA if no version satisfies the |
32 | 32 |
Filters the versions based on multiple conditions: their age and status |
33 | 33 |
} |
34 | 34 |
\examples{ |
35 |
-\donttest{ |
|
35 |
+# creating an example cache record |
|
36 |
+bioc_url <- 'https://bioconductor.org/' |
|
37 |
+version <- omnipath_cache_latest_or_new(url = bioc_url) |
|
38 |
+download.file(bioc_url, destfile = version$path) |
|
39 |
+omnipath_cache_download_ready(version) |
|
36 | 40 |
record <- dplyr::first(omnipath_cache_search('biocond')) |
41 |
+ |
|
37 | 42 |
# only the versions with status "ready" |
38 | 43 |
version_numbers <- omnipath_cache_filter_versions(status = 'ready') |
39 |
-} |
|
44 |
+omnipath_cache_remove(url = bioc_url) # cleaning up |
|
40 | 45 |
|
41 | 46 |
} |
... | ... |
@@ -26,7 +26,7 @@ versions with `ready` (completed download) status are selected} |
26 | 26 |
} |
27 | 27 |
\value{ |
28 | 28 |
Character vector with version IDs, NA if no version satisfies the |
29 |
-conditions |
|
29 |
+ conditions |
|
30 | 30 |
} |
31 | 31 |
\description{ |
32 | 32 |
Filters the versions based on multiple conditions: their age and status |
... | ... |
@@ -33,7 +33,7 @@ Filters the versions based on multiple conditions: their age and status |
33 | 33 |
} |
34 | 34 |
\examples{ |
35 | 35 |
\donttest{ |
36 |
-record <- omnipath_cache_search('biocond') \%>\% dplyr::first |
|
36 |
+record <- dplyr::first(omnipath_cache_search('biocond')) |
|
37 | 37 |
# only the versions with status "ready" |
38 | 38 |
version_numbers <- omnipath_cache_filter_versions(status = 'ready') |
39 | 39 |
} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,41 @@ |
1 |
+% Generated by roxygen2: do not edit by hand |
|
2 |
+% Please edit documentation in R/cache.R |
|
3 |
+\name{omnipath_cache_filter_versions} |
|
4 |
+\alias{omnipath_cache_filter_versions} |
|
5 |
+\title{Filters the versions from one cache record} |
|
6 |
+\usage{ |
|
7 |
+omnipath_cache_filter_versions( |
|
8 |
+ record, |
|
9 |
+ latest = FALSE, |
|
10 |
+ max_age = NULL, |
|
11 |
+ min_age = NULL, |
|
12 |
+ status = CACHE_STATUS$READY |
|
13 |
+) |
|
14 |
+} |
|
15 |
+\arguments{ |
|
16 |
+\item{record}{A cache record} |
|
17 |
+ |
|
18 |
+\item{latest}{Return the most recent version} |
|
19 |
+ |
|
20 |
+\item{max_age}{The maximum age in days (e.g. 5: 5 days old or more recent)} |
|
21 |
+ |
|
22 |
+\item{min_age}{The minimum age in days (e.g. 5: 5 days old or older)} |
|
23 |
+ |
|
24 |
+\item{status}{Character vector with status codes. By default only the |
|
25 |
+versions with `ready` (completed download) status are selected} |
|
26 |
+} |
|
27 |
+\value{ |
|
28 |
+Character vector with version IDs, NA if no version satisfies the |
|
29 |
+conditions |
|
30 |
+} |
|
31 |
+\description{ |
|
32 |
+Filters the versions based on multiple conditions: their age and status |
|
33 |
+} |
|
34 |
+\examples{ |
|
35 |
+\donttest{ |
|
36 |
+record <- omnipath_cache_search('biocond') \%>\% dplyr::first |
|
37 |
+# only the versions with status "ready" |
|
38 |
+version_numbers <- omnipath_cache_filter_versions(status = 'ready') |
|
39 |
+} |
|
40 |
+ |
|
41 |
+} |