Loads all time-varying variables and returns them either as a data.table or as a list of rasters. See pgvariables for available variables. If an official release is specified (or version, type and hashes are NULL), then this is downloaded if this is not already done.
Usage
read_pg_timevarying(
version = NULL,
type = NULL,
spatial_hash = NULL,
temporal_hash = NULL,
as_raster = FALSE,
test = FALSE,
overwrite = FALSE
)Arguments
- version
Character string specifying PRIOGRID version.
- type
Character string specifying release type (e.g., "05deg_yearly").
- spatial_hash
Character string with 6-character spatial hash (custom only).
- temporal_hash
Character string with 6-character temporal hash (custom only).
- as_raster
Logical. If TRUE, returns list of SpatRasters. If FALSE (default), returns data.table.
- test
Logical. If TRUE, returns coverage summary data.frame.
- overwrite
Logical. If FALSE (default) and cached file exists, returns cached data. If TRUE, rebuilds from individual variables.
Value
data.table with pgid + measurement_date as rows and variables as columns, or list of terra SpatRasters if as_raster=TRUE, or coverage test data.frame if test=TRUE
Examples
if (FALSE) { # \dontrun{
# Load as data.table
pg_dt <- read_pg_timevarying()
# Test coverage
coverage <- read_pg_timevarying(test = TRUE)
# Load as rasters
pg_rast <- read_pg_timevarying(as_raster = TRUE)
# Load official release
pg_dt <- read_pg_timevarying(version = "3.0.1",
type = "05deg_yearly")
} # }