async_filter | R Documentation |
async_filter
keep the elements for which .p
is true. (Tested
via isTRUE()
. async_reject
is the opposite, it drops them.
async_filter(.x, .p, ...)
async_reject(.x, .p, ...)
.x |
A list or atomic vector. |
.p |
An asynchronous predicate function. |
... |
Additional arguments to the predicate function. |
A deferred value for the result.
Other async iterators:
async_detect()
,
async_every()
,
async_map()
## Filter out non-working URLs
afun <- async(function(urls) {
test_url <- async_sequence(
http_head, function(x) identical(x$status_code, 200L))
async_filter(urls, test_url)
})
urls <- c("https://eu.httpbin.org/get",
"https://eu.httpbin.org/status/404")
synchronise(afun(urls))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.