fifa19 <- fifa19 >
mutate(Experience = case_when(
Age > 16 & Age <= 21 ~ “Rookie”,
Age > 21 & Age <= 26 ~ “Little Experience”,
Age > 25 & Age <= 31 ~ “Experienced”,
Age > 31 & Age <= 36 ~ “Very experienced”,
Age > 36 ~ “Veteran”
))
Hi @walteratito. The structure of the case_when()
function looks okay, but the example code does not show the pipe operator (%>%
). Is this what you tried?
library(dplyr)
fifa19 <- fifa19 %>%
mutate(Experience = case_when(
Age > 16 & Age <= 21 ~ “Rookie”,
Age > 21 & Age <= 26 ~ “Little Experience”,
Age > 25 & Age <= 31 ~ “Experienced”,
Age > 31 & Age <= 36 ~ “Very experienced”,
Age > 36 ~ “Veteran”
))
Hi @casey, I had the pipe operator already. I’m not still sure why it’s not creating the new column and I also have the libraries packages.