Learn R Programming

medfate (version 4.7.0)

summary.spwb: Summarize simulation results

Description

Function summary summarizes the model's output in different temporal steps (i.e. weekly, annual, ...).

Usage

# S3 method for spwb
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

# S3 method for pwb summary( object, freq = "years", output = "WaterBalance", FUN = sum, bySpecies = FALSE, months = NULL, ... )

# S3 method for growth summary( object, freq = "years", output = "WaterBalance", FUN = sum, bySpecies = FALSE, months = NULL, ... )

# S3 method for fordyn summary( object, freq = "years", output = "WaterBalance", FUN = sum, bySpecies = FALSE, months = NULL, ... )

Value

A matrix with dates as row names and the desired summaries in columns

Arguments

object

An object of class spwb, pwb, growth or fordyn.

freq

Frequency of summary statistics (see cut.Date).

output

The data table to be summarized. Accepted values are the path to data tables in object, such as 'WaterBalance', 'Soil', 'Stand' or 'Plants$LAI'. It is also possible to use strings like 'Transpiration' and the function will interpret it as 'Plants$Transpiration'.

FUN

The function to summarize results (e.g., sum, mean, ...)

bySpecies

Allows aggregating output by species before calculating summaries (only has an effect with some values of output). Aggregation can involve a sum (as for plant lai or transpiration) or a LAI-weighted mean (as for plant stress or plant water potential).

months

A vector of month numbers (1 to 12) to subset the season where summaries apply.

...

Additional parameters for function summary.

Author

Miquel De Cáceres Ainsa, CREAF

See Also

spwb, pwb, growth, fordyn, plot.spwb, extract

Examples

Run this code
# \donttest{
#Load example daily meteorological data
data(examplemeteo)

#Load example plot plant data
data(exampleforest)

#Default species parameterization
data(SpParamsMED)

#Define soil with default soil params (4 layers)
examplesoil <- defaultSoilParams(4)

#Initialize control parameters
control <- defaultControl("Granier")

#Initialize input
x <- spwbInput(exampleforest,examplesoil, SpParamsMED, control)

#Call simulation function
S1<-spwb(x, examplemeteo, latitude = 41.82592, elevation = 100)

#Queries the tables in 'Soil'
names(S1$Soil)

#Monthly summary (averages) of soil relative water content
summary(S1, freq="months",FUN=mean, output="RWC")

#Queries the tables in 'Plants'
names(S1$Plants)

#Monthly summary (averages) of plant stress
summary(S1, freq="months",FUN=mean, output="PlantStress", 
        bySpecies = TRUE)
# }

Run the code above in your browser using DataLab