man/omnipath_cache_filter_versions.Rd
17c08fe7
 % Generated by roxygen2: do not edit by hand
 % Please edit documentation in R/cache.R
 \name{omnipath_cache_filter_versions}
 \alias{omnipath_cache_filter_versions}
 \title{Filters the versions from one cache record}
 \usage{
 omnipath_cache_filter_versions(
   record,
   latest = FALSE,
   max_age = NULL,
   min_age = NULL,
   status = CACHE_STATUS$READY
 )
 }
 \arguments{
 \item{record}{A cache record}
 
 \item{latest}{Return the most recent version}
 
 \item{max_age}{The maximum age in days (e.g. 5: 5 days old or more recent)}
 
 \item{min_age}{The minimum age in days (e.g. 5: 5 days old or older)}
 
 \item{status}{Character vector with status codes. By default only the
 versions with `ready` (completed download) status are selected}
 }
 \value{
 Character vector with version IDs, NA if no version satisfies the
2e7bce57
     conditions.
17c08fe7
 }
 \description{
 Filters the versions based on multiple conditions: their age and status
 }
 \examples{
be9cdd4c
 # creating an example cache record
 bioc_url <- 'https://bioconductor.org/'
 version <- omnipath_cache_latest_or_new(url = bioc_url)
41d6808d
 httr::GET(bioc_url, httr::write_disk(version$path, overwrite = TRUE))
be9cdd4c
 omnipath_cache_download_ready(version)
af0ed3dd
 record <- dplyr::first(omnipath_cache_search('biocond'))
be9cdd4c
 
17c08fe7
 # only the versions with status "ready"
4021df7e
 version_numbers <- omnipath_cache_filter_versions(record, status = 'ready')
be9cdd4c
 omnipath_cache_remove(url = bioc_url) # cleaning up
17c08fe7
 
 }