# NOT RUN {
# To convert data frame to tidy data (long) format, run:
library(dplyr)
library(tidyr)
library(stringr)
drinks_tidy <- drinks %>%
gather(type, servings, -c(country, total_litres_of_pure_alcohol)) %>%
mutate(
type = str_sub(type, start=1, end=-10)
) %>%
arrange(country, type)
# }
Run the code above in your browser using DataLab