aggregateYears: Aggregate years

aggregateYearsR Documentation

Aggregate years

Description

Aggregated all available years in a Field or a data.table object (with years denoted by column "Years").

Usage

aggregateYears(x, method = "mean", verbose = FALSE)

Arguments

x

A Field or data.table (with a "Year" column)

method

A character string describing the method by which to aggregate the data. Can currently be "mean", "mode", "median", "sum", "max", "min", "sd", "var" and "cv" (= coefficient of variation: sd/mean). For technical reasons these need to be implemented in the package in the code however it should be easy to implement more, please just contact the author!

verbose

If TRUE give some progress update about the averaging.

Value

A Field or data.table depending on the input object

Author(s)

Matthew Forrest matthew.forrest@senckenberg.de

Examples


 
# Get an example Field
test.dir <- system.file("extdata", "LPJ-GUESS_Runs", "CentralEurope", package = "DGVMTools")
test.Source <- defineSource(name = "LPJ-GUESS", dir = test.dir,  format = GUESS)
field <- getField(source = test.Source, quant = "lai")

# calculate of mean of all years
mean.allyears <- aggregateYears(x = field, method = "mean", verbose = TRUE)
print(mean.allyears@data)
print(plotSpatial(mean.allyears))

#  calculate standard deviation of all years
sd.allyears <- aggregateYears(x = field, method = "sd", verbose = FALSE)
print(sd.allyears@data)
print(plotSpatial(sd.allyears))




MagicForrest/DGVMTools documentation built on Aug. 23, 2024, 8:05 a.m.