time_at_events: time at maximum/minimum

time_at_eventsR Documentation

time at maximum/minimum

Description

helpers for sfn_metrics

Usage

max_time(x, time)

min_time(x, time)

Arguments

x

a numeric vector, usually a variable in the sapflow or environmental data.

time

a POSIXct or character vector with the TIMESTAMP values

Details

These helper functions return the TIMESTAMP value at which the maximum value for other variable occurs. It is designed to be used inside a dplyr summarise statement.

Value

a single value (POSIXct) with the TIMESTAMP value.

Functions

  • max_time(): helper for sfn_metrics

  • min_time(): helper for sfn_metrics

Examples

library(dplyr)
storms %>%
  group_by(year) %>%
  summarise(wind_max = max(wind),
            hour_at_max = sapfluxnetr:::max_time(wind, time = hour),
            wind_min = min(wind),
            hour_at_min = sapfluxnetr:::min_time(wind, time = hour))


sapfluxnetr documentation built on Feb. 16, 2023, 7:52 p.m.