Home > Net >  How to find number of storms per year since 2010?
How to find number of storms per year since 2010?

Time:11-06

The question says: Find the number of storms per year since 2010.

So far, I have this as my code in R.

The data set is "storms" which is a dataset that is loaded into R, and is a subset of the NOAA Atlantic hurricane database.

storms %>% 
  select(status, year) %>% 
  filter(year == 2010) %>% 
  tally()

What I don't know is if the "since" keyword means before 2010 or should I just count the number of storms found in 2010?

CodePudding user response:

Storms since 2010 per year means including 2010 and afterwards the number of storms each year. Maybe this is what the question is asking:

storms2 = storms %>% filter(year>= 2010)
storms2 %>% count(year)
# A tibble: 11 × 2
    year     n
   <dbl> <int>
 1  2010   402
 2  2011   323
 3  2012   454
 4  2013   202
 5  2014   139
 6  2015   220
 7  2016   396
 8  2017   306
 9  2018   266
10  2019   330
11  2020   570
  •  Tags:  
  • r
  • Related