yearstat: Yearly <stat>

yearstatR Documentation

Yearly <stat>

Description

The function yearstat aggregates the data from monthly to yearly.

Usage

yearstat(x, stat = "sum")

## S4 method for signature 'Raster'
yearstat(x, stat = "sum")

## S4 method for signature 'data.table'
yearstat(x, stat = "sum")

## S4 method for signature 'character'
yearstat(x, stat = "sum")

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

stat

character

Details

If 'x' is a data.table, its columns should be named: "lon", "lat", "date", and "value"

If 'x' is a filename, it should point to a *.nc file.

'stat' is a character string describing the desired aggregation function. Suitable options are:

  • "max"

  • "mean"

  • "median"

  • "min"

  • "sum" (default)

Value

Raster* object; data.table

Examples

## Not run: 
download_data("gldas-vic", path = tempdir())
r <- raster::brick(paste0(tempdir(),
"/gldas-vic_tp_mm_land_194801_201412_025_monthly.nc"))
s <- yearstat(r, "mean")

## End(Not run)

pRecipe documentation built on May 29, 2024, 9:11 a.m.