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