Last active
April 3, 2019 12:20
-
-
Save berkorbay/5793188b7ebfe013ce64703179f9aa01 to your computer and use it in GitHub Desktop.
Week 4 preparation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pti <- c("shiny","tidyverse","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