Skip to contents

Extract a time window in year from a data frame.

Usage

seasCenter(data, j, sw = 45)

Arguments

data

The data frame. Must have a Day column giving the Julian day.

j

The center Julian day. Can be given as an integer between 1 and 365 or as character string such as "07-21" for the 21-th of July.

sw

Semi-width (in days) of the sliding period). So sw = 45 means that the fit is made on a period of 90 days.

Value

A subset data frame.

Details

Based on the column Day in the data frame, and the give Julian day for the center we extract the corresponding observations. This function is useful e.g., to investigate the form of the seasonality on a parameter.

Examples

df <- seasCenter(Rennes, j = "07-21")
sort(unique(format(df$Date, "%m-%d")))
#>  [1] "06-06" "06-07" "06-08" "06-09" "06-10" "06-11" "06-12" "06-13" "06-14"
#> [10] "06-15" "06-16" "06-17" "06-18" "06-19" "06-20" "06-21" "06-22" "06-23"
#> [19] "06-24" "06-25" "06-26" "06-27" "06-28" "06-29" "06-30" "07-01" "07-02"
#> [28] "07-03" "07-04" "07-05" "07-06" "07-07" "07-08" "07-09" "07-10" "07-11"
#> [37] "07-12" "07-13" "07-14" "07-15" "07-16" "07-17" "07-18" "07-19" "07-20"
#> [46] "07-21" "07-22" "07-23" "07-24" "07-25" "07-26" "07-27" "07-28" "07-29"
#> [55] "07-30" "07-31" "08-01" "08-02" "08-03" "08-04" "08-05" "08-06" "08-07"
#> [64] "08-08" "08-09" "08-10" "08-11" "08-12" "08-13" "08-14" "08-15" "08-16"
#> [73] "08-17" "08-18" "08-19" "08-20" "08-21" "08-22" "08-23" "08-24" "08-25"
#> [82] "08-26" "08-27" "08-28" "08-29" "08-30" "08-31" "09-01" "09-02" "09-03"