Learn R Programming

sapfluxnetr (version 0.1.5)

time_at_events: time at maximum/minimum

Description

helpers for sfn_metrics

Usage

max_time(x, time)

min_time(x, time)

Value

a single value (POSIXct) with the TIMESTAMP value.

Arguments

x

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

time

a POSIXct or character vector with the TIMESTAMP values

Functions

  • max_time(): helper for sfn_metrics

  • min_time(): helper for sfn_metrics

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.

Examples

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

Run the code above in your browser using DataLab