Data Science Desktop Survival Guide
by Graham Williams |
|||||
Case Statement |
library(dplyr)
with(ds, case_when(max_temp > 35 ~ "hot", max_temp > 25 ~ "warm", max_temp > 18 ~ "mild", max_temp > 12 ~ "cool", max_temp > 0 ~ "cold", TRUE ~ "freezing"))
|