selyear: Select Years

selyearR Documentation

Select Years

Description

The function selyear subsets the data in time within a year range.

Usage

selyear(x, y)

## S4 method for signature 'Raster'
selyear(x, y)

## S4 method for signature 'data.table'
selyear(x, y)

## S4 method for signature 'character'
selyear(x, y)

Arguments

x

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

y

numeric. Time range in the form: (start_year, end_year)

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.

Value

Raster* object; data.table

Examples

## Not run: 
download_data("gldas-vic", tempdir(), timestep = "yearly")
r <- raster::brick(paste0(tempdir(),
"/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc"))
s <- selyear(r, c(2000, 2010))

## End(Not run)

pRecipe documentation built on Nov. 23, 2023, 1:08 a.m.