Instantly share code, notes, and snippets.

Embed
What would you like to do?
Week 4 preparation
pti <- c("shiny","reticulate","ggplot2movies")
pti <- pti[!(pti %in% installed.packages())]
if(length(pti)>0){
install.packages(pti)
}
##########
### Shiny starter code
##########
library(shiny)
library(tidyverse)
library(ggplot2movies)
# Set randomness seed
set.seed(61)
# Prepare data
shiny_movie_set <-
movies %>%
filter(year >= 2000) %>%
select(title,year,length,rating,votes,Action:Short) %>%
gather(genre,value,Action:Short) %>%
filter(value == 1) %>%
select(-value)
# Get genre list
genres <-
shiny_movie_set %>%
distinct(genre) %>%
unlist(.)
names(genres) <- NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment