# NOT RUN {
# To convert data frame to tidy data (long) format, run
library(dplyr)
library(tidyr)
library(stringr)
riddler_castles_tidy<-riddler_castles2 %>%
pivot_longer(castle1:castle10, names_to = "castle" , values_to = "soldiers") %>%
mutate(castle = as.numeric(str_replace(castle, "castle","")))
# }
Run the code above in your browser using DataLab