rvn_which_max_xts {RavenR}R Documentation

which.max for xts objects

Description

Applies the which.max function and returns an xts object with the maximum value and associated date.

Usage

rvn_which_max_xts(x)

Arguments

x

xts object to apply which.max to

Details

Acts as the which.max function, applicable to xts objects and returning values in an xts format.

Note that when deploying the rvn_apply_wyearly function, the dates are overwritten and the dates of the water year ending periods are displayed rather than the event dates. In order to obtain the corresponding dates when using the rvn_apply_wyearly function, please use rvn_apply_wyearly_which_max_xts.

Value

xts object with max value and corresponding date

See Also

which.max base which.max function rvn_apply_wyearly_which_max_xts for using apply_wyearly with the rvn_which_max_xts function

Examples

data(rvn_hydrograph_data)

# obtain the peak observed flow and the corresponding date
rvn_which_max_xts(rvn_hydrograph_data$hyd$Sub43_obs)

# note that the usual rvn_apply_wyearly does not provide the correct dates with this function
rvn_apply_wyearly(rvn_hydrograph_data$hyd$Sub43_obs, rvn_which_max_xts)


[Package RavenR version 2.2.2 Index]