Created
February 13, 2017 23:14
-
-
Save yvlau92/5e550eb6b83441dc3d8bd0e0c5aa6a33 to your computer and use it in GitHub Desktop.
Distribution of restaurant grades
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
# Shiny Server Code to render distribution of grades plot | |
output$grade_plot <- renderGvis({ | |
# transform data for GoogleVis: group by year and grade | |
grade_only_grouped <- grade_data()%>% | |
group_by(year,grade)%>% | |
summarise(n=n()) | |
#melt and cast data into the format for stacked googlevis | |
mgrade_only <- melt(grade_only_grouped, id = c("grade","year")) | |
grade_dist <- cast(mgrade_only, year~grade,sum) | |
gvisColumnChart(grade_dist, options = list( | |
isStacked="percent", colors="['#A6D0BD','#565656','red']")) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment