Photo by Sharon McCutcheon on Unsplash.
Create a scatterplot of two numerical variables in the diamonds
dataset. This should be an interactive plot created with shiny such that the user selects the variable to be placed on the x and y axes from a drop down menu. You can place that drop down menu on the sidebar (like in the class example), or feel ree to get creative with it…
Then, add functionality to color the points on the scatterplot by a categorical variable in the dataset. The user should also be able to choose the categorical variable from a drop down menu.
Go through the diamonds
dataset and decide which variables are categorical and which are numerical.
Then, first make a static version of a plot so that you develop the ggplot2
code. Then work on building the app by wrapping it in appropriate functions from the shiny package.
Feel free to use whatever code from the class demo you find is useful / relevant.
Once the tidyverse
package is loaded, you can load the dataset with
Create an app using data from your project, and use an alternate styling than the default using the shinythemes
package.
First start with the app you created in Part 1 or the one from class, swap out the dataset, and then add functionality.
Your app does not have to feature a data visualization.
You can learn more about how the shinythemes
package works at here.
Move your project data into the part-02/data/
folder in your repo and load it from there with something like
on top of your app.R
file.
Build a dashboard using the flexdashboard package and data from your project.
One of the main differences between the flexdashboard and shiny packages is that flexdashboards are built in R Markdown and Shiny apps are built in R scripts. Luckily you know how to work with both!
Another difference is that we do not need to specify UI and server components explicitly in flexdashboards.
However what is common is that we still use the same UI elements (e.g. selectInput()
) and same mechanisms bot reactivity (e.g. renderPlot()
).
The functionality of the dashboard can be same/similar to the app you built in part 2, or you can change things up if you prefer.
A sample dashboard is provided in your repository at part-03-sample
. Start by investigating how it works. You can use this as your starting point as well.
Find out more about the flexdashboard
package here.
You can use shinythemes
with a flexdashboard
as well – this is not required but feel free to give it a try.
Move your project data into the part-03/data/
folder in your repo and load it from there with something like
Deploy one of your apps from Part 2 or Part 3.
To do so:
Following guidance from Section 2.2, have one of the team members create a Shinyapps.io account at the free tier.
Following guidance from Section 2.3, deploy your app. Along the way RStudio might ask you to install certain packages, say yes.
Add a link to the deployed app to the README of your repo, and send along to friends and family :)