# NOT RUN {
# To convert data frame to tidy data (long) format, run:
library(dplyr)
library(tidyr)
library(stringr)
candy_rankings_tidy <- candy_rankings %>%
pivot_longer(-c(competitorname, sugarpercent, pricepercent, winpercent),
names_to = "characteristics", values_to = "present") %>%
mutate(present = as.logical(present)) %>%
arrange(competitorname)
# }
Run the code above in your browser using DataLab