ps_add_season: Add Season

ps_add_seasonR Documentation

Add Season

Description

Returns a data frame with the season and the year. If the first month of the first season isn't January (1L), then the last season is considered to wrap into the following year.

Usage

ps_add_season(
  x,
  date = "Date",
  season = "Season",
  year_season = "YearSeason",
  seasons = c(Spring = 3L, Summer = 6L, Autumn = 9L, Winter = 12L)
)

Arguments

x

A data frame

date

A string of the name of the column with the Dates or POSIXt objects.

season

A string of the name of the column to save the seasons.

year_season

A string of the name of the column to save the year of the season.

seasons

A uniquely named integer vector of the first month of each season.

Value

An original data frame with a season and year column.

Examples

x <- data.frame(Date = as.Date(c("2000-12-31", "2001-01-01", "2001-06-01", "2001-12-31")))
ps_add_season(x)

poissonconsulting/poisix documentation built on May 28, 2022, 10:42 p.m.