Find Season of Particular Date in R (Example Code)

In this R tutorial you’ll learn how to return the seasons of specific dates.

Creation of Example Data

x <- as.Date(c("2022-11-11",           # Create vector of dates
               "2021-05-02",
               "2025-12-17",
               "2023-08-01"))
x
# [1] "2022-11-11" "2021-05-02" "2025-12-17" "2023-08-01"

Example: Convert Dates to Seasons

install.packages("hydroTSM")           # Install & load hydroTSM
library("hydroTSM")
time2season(x, out.fmt = "seasons")    # Get seasons
# [1] "autumm" "spring" "winter" "summer"

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top