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