Assignment B-3

Total Points: 100

For this assignment, you’ll be creating your own shiny app with three features, and deploying it.

The grading rubric is detailed at the very end. Note that we aren’t expecting a complex app for this assignment – a simple one is all we’re expecting.

Here are some examples of apps built with Shiny. We don’t expect you to achieve the level of complexity in any of these, but they are examples that may inspire you in terms of what you want to do with your own app!

Setup

Go to canvas to get your invitation to create a GitHub repository for this project. You can find this in the description of Assignment B-3. Name your repo as you wish, so long as it’s informative.

Feature ideas

There are countless possibilities for features, but here are just a few ideas. You can choose any 3 or more ideas from this list or do anything else! Want more ideas than what’s below? Check this out.

While (this year) you will be developing your own Shiny app from scratch instead of building on the BC Liquor App developed in Dean Attali’s tutorial, we will use the BC Liquor App as a running example of feature ideas for concreteness.

If you have a table in your app…

  • Add an option to sort the table by one of your variables. For example, in the BC Liquor App, sorting the results by price.
    • Hint: Use checkboxInput() to get TRUE/FALSE values from the user.
  • Use the DT package to turn a static table into an interactive table.
    • Hint: Install the DT package, replace tableOutput() with DT::dataTableOutput() and replace renderTable() with DT::renderDataTable().
  • Show the number of results found whenever the filters change. For example, in the BC Liquor app, when searching for Italian wines $20 - $40, show the text “We found 122 options for you”.
    • Hint: Add a textOutput() to the UI, and in its corresponding renderText() use the number of rows in the filtered() object.
  • Allow the user to download your table as a .csv file.
    • Hint: Look into the downloadButton() and downloadHandler() functions.
  • Allow the user to search for multiple entries simultaneously; for example, in the BC Liquor app, allow the user to search for multiple alcohol types at once instead of wine/beer/etc, one at a time.
    • Hint: There are two approaches to do this. Either change the typeInput radio buttons into checkboxes (checkboxGroupInput()) since checkboxes support choosing multiple items, or change typeInput into a select box (selectInput()) with the argument multiple = TRUE to support choosing multiple options.

If you have a plot in your app…

  • Add parameters to the plot.
    • Hint: You will need to add input functions that will be used as parameters for the plot. You could use shinyjs::colourInput() to let the user decide on the colours of the bars in the plot.

Other ideas:

  • Add an image to the UI. For example, in the BC Liquor app, add an image of the BC Liquor Store. If you’re building your own app from scratch, an image may make your app more visually interesting or add information!
    • Hint: Place the image in a folder named www, and use img(src = "imagename.png") to add the image.
  • If you know CSS, add CSS to make your app look nicer.
    • Hint: Add a CSS file under www and use the function includeCSS() to use it in your app.
  • Experiment with packages that add extra features to Shiny, such as shinyjs, leaflet, shinydashboard, shinythemes, ggvis.
    • Hint: Each package is unique and has a different purpose, so you need to read the documentation of each package in order to know what it provides and how to use it.
  • If you have both a plot and a table, place them in separate tabs.
    • Hint: Use tabsetPanel() to create an interface with multiple tabs.

Rubric

Shiny app development (75 points)

  • There are three features in your Shiny app. Clearly state which three features you are modifying or creating in your code, with comments. Specifically, write a sentence per feature explaining how it is useful. (60 pts, 20 per feature)

  • What are we looking for in your features?

    • Variety. Including three tables as part of your dashboard and having the same exact feature for each of them (e.g. a filtering option, even if the tables are distinct) will be penalized; at least 2 of the 3 features must be unique.
    • We will also evaluate the usefulness of your features in the context of your app (does it add to the user experience?). We expect your features to be sensible, meaning that they add to the user experience in a way that makes sense - as an example, adding a filtering option for “country” in a table that only has data for Canada does not seem very useful, even if you added the filtering feature correctly. If we consider any of your features to be irrelevant for the app, 2 pts will be penalized for that particular feature.
  • RRR (15 pts):

    • Code runs without errors and it is appropriately annotated, legible, and easy to follow. (8 pts)
    • Your app should be deployed online on shinyapps.io (or on another server if you’d like). Make sure your app actually works online (sometimes your app will work in RStudio but will have errors on shinyapps.io - make sure you deploy early and often to make debugging easier). (7 pts)

Tidy Submission (25 points)

Follow these steps to submit your work. Be sure to familiarize yourself with the rubric for a tidy submission below, before doing these steps.

  • (20 pts) Make a README for your repository. The README must include:
    • A link to a running instance of your Shiny app.
    • A description of your app.
    • Whatever dataset you will use, acknowledge its source clearly. Remember that we value open, reproducible science: this means that the user of your app should have direct access to the data, or know where to go to access it.
  • (5 pts) Tag a release in your assignment repository.
  • Submit a link to your tagged release in your assignment repository to canvas. Make sure the TAs and Lucy can see your repository! Either it should be public or private with TAs and Lucy added as collaborators.

Acknowledgements

This homework was originally developed by Dean Attali, with modifications by Giulio Valentino Dalla Riva, and has been further modified for the current year.