R: Test if a URL is accessible

url_accessible {xfun} | R Documentation

## Test if a URL is accessible

### Description

Try to send a `HEAD` request to a URL if curl is available, otherwise try to download the URL via `xfun::download_file()`, and see if it succeeds.

### Usage

    url_accessible(x, use_curl = loadable("curl"))

### Arguments

`x` | A URL as a character string.
`use_curl` | Whether to use the curl package.

### Value

`TRUE` or `FALSE`.

### Examples

    xfun::url_accessible("https://yihui.org")

[Package xfun version 0.28 Index]