Filter out twilight values by range, and returns the data frame with a twilight (TRUE/FALSE) column or the data frame with only twilight values selected (filtered out).

stk_filter(
  data,
  range,
  smooth = TRUE,
  plot = FALSE,
  filter = FALSE,
  verbose = TRUE
)

Arguments

data

a skytrackr compatible data frame

range

a range c(min, max) of valid values in lux, or a single threshold value

smooth

smooth the data using a hampel filter with a window size of 3, and a multiplier of the MAD of 3. Original values are substituted, the values replaced are flagged in an `outlier` column in the returned data frame (default = TRUE)

plot

plot daily profiles with the range filter applied

filter

if TRUE only twilight values are returned if FALSE the data frame is returned with an annotation column called 'twilight' for further processing.

verbose

Give detailed feedback (TRUE or FALSE, default = TRUE)

Value

a skytrackr compatible data frame, either filtered to only include twilight values selected by the range parameter or with an additional 'twilight' column to annotate these values.

Details

Generally used for internal process, but can be useful for visualizations of profiles as well.

Examples


# filter values using the preset range, only annotate
df <- cc876 |> stk_filter(range = c(1.5, 400))
#> → Smoothing the data using a Hampel filter[outliers will be replaced with interpolated values]

# filter values using the preset range, only retain filtered values
df <- cc876 |> stk_filter(range = c(1.5, 400), filter = TRUE)
#> → Smoothing the data using a Hampel filter[outliers will be replaced with interpolated values]