1. Learn
  2. /
  3. Courses
  4. /
  5. Building Web Applications with Shiny in R

Exercise

Explore the Mental Health in Tech 2014 Survey

Don't be intimidated, but in this exercise, you're going to build the entirety of this app (minus the custom error message) in one go!

For this app, you'll be using the questions "Do you think that discussing a mental health issue with your employer would have negative consequences?" (the mental_health_consequence variable) and "Do you feel that your employer takes mental health as seriously as physical health?" (mental_vs_physical) as multi-selector inputs, then displaying a histogram of the Age of respondents. To see the choices for these variables, count() them in the console.

Recall that when you're finished, the app will look like this (including the blank plot): An app displaying questions from a Mental Health survey

shiny, ggplot2, dplyr, and the mental_health_survey dataset have all been loaded for you.

Instructions

100 XP
  • UI:
    • Add an appropriate title to the app.
    • Add a checkboxGroupInput(). Include a default value for the selected argument.
    • Add a pickerInput() with the multiple argument set to TRUE.
    • Add a plotOutput() in the main panel.
  • Server:
    • Add an output that displays a histogram the Age of respondents, filtered by the two inputs.