Applies the base::max function across columns.
cmax(x, na.rm = FALSE)
object to apply the max function to
whether to remove na values from the calculation
x with the max value in each column determined
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.
rvn_apply_wyearly
where this function can be applied for the water year,
and the xts functions such as apply.yearly
and apply.monthly
data(rvn_hydrograph_data)
cmax(rvn_hydrograph_data$hyd$Sub43_obs, na.rm=TRUE)
#> Sub43_obs
#> 258
rvn_apply_wyearly(rvn_hydrograph_data$hyd, cmax, na.rm=TRUE)
#> precip Sub36 Sub36_obs Sub43 Sub43_obs
#> 2003-09-30 04:00:00 32.2238 98.0247 74.4 99.6387 103
#> 2004-09-30 04:00:00 34.7881 156.0300 168.0 160.7270 258