cmax: cmax

View source: R/rvn_utilities.R

cmaxR Documentation

cmax

Description

Applies the base::max function across columns.

Usage

cmax(x, na.rm = FALSE)

Arguments

x

object to apply the max function to

na.rm

whether to remove na values from the calculation

Details

It applies the base::max function over columns, which is advantageous for calculating the max within a column rather than the max of the whole data frame. The default base::max will not work properly for data frames and other structures in applying over columns or different periods.

This function was included for usage with the apply.<period> and rvn_apply_wyearly function, as the base::max function does not work properly across columns.

Value

x with the max value in each column determined

See Also

rvn_apply_wyearly where this function can be applied for the water year, and the xts functions such as apply.yearly and apply.monthly

Examples

data(rvn_hydrograph_data)
cmax(rvn_hydrograph_data$hyd$Sub43_obs, na.rm=TRUE)

rvn_apply_wyearly(rvn_hydrograph_data$hyd, cmax, na.rm=TRUE)


rchlumsk/RavenR documentation built on April 19, 2024, 5:15 a.m.