mardi 12 novembre 2019

Creating a season column corresponding to month column

I'm new to R, trying to figure out what I've done wrong here. I have a column with month names in them (January - December) and trying to fit a column with seasons corresponding to the month. This is my workings so far:

House$Season <- ifelse (House$month %in% c('May','June','July'), 
"SUMMER",
ifelse (House$month %in% c('August','September','October'), 
"AUTUMN",
ifelse (House$month %in% c('November','December','January'), 
"WINTER",
ifelse (House$month %in% c('February','March','April')), 
"SPRING"))))

I've tried many different things but this is what I'm currently on. I know I'm probably completely off, I'm beginner as I said so any help would be greatly appreciated. Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire