Access data stored online.

download_data(x, destfile = NULL)

Arguments

x

A string giving the name of the dataset to download. The name of any dataset listed here (without the extension).

destfile

a character string (or vector, see url) with the name where the downloaded file is saved. Tilde-expansion is performed.

Value

A dataset.

See also

Examples

# Not running CRAN checks (may take longer than the allowed run time limit) # \donttest{ # Defaults to read data # The first call is memoised system.time(download_data("unique_id"))
#> user system elapsed #> 0.015 0.003 0.203
# Subsequent calls use the memoised data, so takes no time system.time(download_data("unique_id"))
#> user system elapsed #> 0 0 0
download_data("unique_id")
#> # A tibble: 3 x 2 #> table column #> <chr> <chr> #> 1 tree TreeID #> 2 stem StemID #> 3 ViewFullTable DBHID
# Can download data to a destination file given by `destfile` tmp <- tempfile() download_data("unique_id", destfile = tmp) load(tmp) unique_id
#> # A tibble: 3 x 2 #> table column #> <chr> <chr> #> 1 tree TreeID #> 2 stem StemID #> 3 ViewFullTable DBHID
available_data <- "https://github.com/forestgeo/fgeo.data/tree/master/data" if (interactive()) browseURL(available_data) # }