You can calculate a series of summary statistics (features) of a given variable for a dataset. For example, a three number summary, the minimum, median, and maximum, can be calculated for a given variable. This is designed to work with the [features()] function shown in the examples. Other available features in `loadflux` include:

feat_event(x)

Arguments

x

A vector to extract features from.

Examples


# You can use any of the features `feat_*` in conjunction with `features`
# like so:
library(dplyr)
library(fabletools)
library(tsibble)
#> 
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, union

djants <- djan %>%
  hydro_events(
    q = discharge,
    datetime = time,
    window = 21
  ) %>%
  as_tsibble(
    key = he,
    index = time
  )

djants %>%
  features(
    time, # variable you want to explore
    feat_event
  ) # the feature summarisation you want to perform
#> # A tibble: 113 × 4
#>       he start               end                 length  
#>    <dbl> <dttm>              <dttm>              <drtn>  
#>  1     1 2017-06-06 11:00:00 2017-06-07 11:00:00 24 hours
#>  2     2 2017-06-07 12:00:00 2017-06-08 09:00:00 21 hours
#>  3     3 2017-06-08 10:00:00 2017-06-09 11:00:00 25 hours
#>  4     4 2017-06-09 12:00:00 2017-06-10 10:00:00 22 hours
#>  5     5 2017-06-10 11:00:00 2017-06-11 12:00:00 25 hours
#>  6     6 2017-06-11 13:00:00 2017-06-12 12:00:00 23 hours
#>  7     7 2017-06-12 13:00:00 2017-06-13 10:00:00 21 hours
#>  8     8 2017-06-13 11:00:00 2017-06-14 08:00:00 21 hours
#>  9     9 2017-06-14 09:00:00 2017-06-15 11:00:00 26 hours
#> 10    10 2017-06-15 12:00:00 2017-06-17 11:00:00 47 hours
#> # … with 103 more rows