Count days of winter

Hello people,

my problem is, i have a huge dataframe of climate dates. from 1951-2021. And just care about the winters. So i kicked out every other month. Now i want to count every day that was colder then 0°C of each winter (for exmaple december 1952 to february 1953). Is there a easy way to do that?

Thank you!

Example Data :

set.seed(42)

(exdf <- data.frame(d=seq.Date(from=Sys.Date()-100,Sys.Date(),by=1),
                   temp = rnorm(101,5,5)))

Solution:

library(tidyverse)

exdf %>% filter(temp<0) %>% count()

thank you for your help!!!
i might not understand it, but this just count every winter together, right? but i want a count per winter.
so that i get from 12.1952-02.1953 the count of days with temp < 0°C
and that per winter

if you can define winter you can use your definition to label your data and group by it.
I recommend that you study such data manipulation techniques from this excellent source.
https://r4ds.had.co.nz/
If you wish specific help on your own data, that we do not possess, then I ask you to please take some time to prepare a reproducible example (reprex)FAQ: How to do a minimal reproducible example ( reprex ) for beginners

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.