Learn R Programming

RavenR (version 2.2.0)

cmax: cmax

Description

Applies the base::max function across columns.

Usage

cmax(x, na.rm = FALSE)

Value

x with the max value in each column determined

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.

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

Run this code
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)

Run the code above in your browser using DataLab