Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

R: how to assign seasons to months (factor)

$
0
0

in my dataset I have the following vector of months:

bank$month <-factor(bank$month, 
                       levels = c("jan", "feb", "mar", "apr", "may", "jun",
                                  "jul", "aug", "sep", "oct", "nov", "dec"))

I would like to assign a vector of 4 seasons to each month. I tried case when/ if else (neither of these work). Any suggestions how to solve this issue?

Many thanks, Kasia


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>