Skip to contents

Retrieve AREAdata dataset/s specified by metric and spatial scale (GID).

Usage

fetch_ad(
  metric = "temp",
  gid = 0,
  use_cache = FALSE,
  cache_location = "user",
  refresh_cache = FALSE,
  basereq = NA
)

Arguments

metric

the metric to retrieve from areadata.

gid

the spatial scale to retrieve (0 = country-level, 1=province-level ...).

use_cache

load files from cache if possible, and save them if not present.

cache_location

path to cache location (defaults to user directory obtained from tools::R_user_dir()).

refresh_cache

force a refresh of the relevant cached data.

basereq

the url of the AREAdata database (usually generated by ad_basereq()). If NA, uses the default.

Value

A ohvbd.ad.matrix of the requested data (with added attributes for gid and metric).

Valid metrics

The following metrics are valid (alternative names are listed in brackets):

  • temp (temperature)

  • spechumid (specific humidity)

  • relhumid (relative humidity)

  • uv (ultraviolet)

  • precip (precipitation, rainfall)

  • popdens (population density, population)

  • forecast (future climate, future)

Author

Francis Windram

Examples

if (FALSE) { # \dontrun{
fetch_ad(metric="temp", gid=0)
} # }