library(tidyverse)
library(ggplot2)
knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)Challenge 10
challenge_10
purrr
The Challenge
I am going to create a function that maps months to numbers.
month_num <- function(vec) {
out <- map_int(vec, function(m) {
return(which(month.name == m))
})
return(out)
}
vec <- c("March", "May", "April")
month_num(vec)[1] 3 5 4