Skip to content

info201b-sp21/ps-shiny

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

8. Build you own app

Overview

This is the last problem set before the final project. As the previous one was about working together with rmarkdown, this one is about working alone with shiny. So you can practice your shiny-skills for the final project! Shiny has a few concepts you have to understand to get going, but once you are comfortable with the general skeleton of these applications, transforming your analyses into interactive experiences goes fairly fast.

The Data

UFO

For this assignment, we'll use UFO sightings data. The data originates from National UFO Research Center and is downloaded from Timothy Renners page. It contains 5177 UFO sightings in the US and Canada in 2016. It contains the following variables:

  • Date: date as mm/dd/yyyy
  • Time: time as hh:mm:ss (12 hr format)
  • AM/PM: am/pm indicator (AM, PM)
  • Country: USA/CANADA
  • City: name of the city where (or near of which) the ufo was seen
  • State: US state or CA province, 2-letter acronym
  • Shape: shape of the ufo (Light/Circle/Sphere/...)
  • lat, lng: geocoded latitude, longitude; based on the city.
  • Summary: brief description of sighting

Assignment Structure

As with previous assignments, follow the link to create your own private repository for this assignment (well, if you are reading this readme you probably already did it). This will automatically create a private repository which you will submit to Canvas as your assignment. Note this is an individual assigment, so you have to create your own repo, not rely on your teammates.

Complete the following steps:

Your task is to build your own shiny application. The application should provide users with the ability to interactively explore the UFO dataset. What the application looks like is up to you (but see below for a few ideas), as long as it meets the following requirements:

  • There is a side panel in which you've created at least two widgets that change the visual output in your application, such as type of the plot, or data displayed on the x or y axis of a scatterplot. Note: I mean side panel but it does not have to be sidebarLayout.
  • There is a main panel where the data is presented (as plot or table).
  • You must create at least one visual representation of a dataset (a plot) that reacts to the widgets in the sidepanel
  • You must also add some textual output that reacts to a widget, such as the number of non-missing observations, or the most common UFO type in different states.
  • One of your widgets must change the data that is being displayed. For instance, the user may be able to choose between distribution of date and distribution of shape. If the widget only changes color of the plot, it will not count.
  • Your plots, tables, maps and whatever you come up with must be appropriately labeled and use appropriate colors.
  • You must push your application up to the shinyapps.io server (or another server if you like), making it publicly available
  • For this application, use the multiple-file setup (i.e both ui.R and server.R):
    • A ui.R file that drives the structure of the user interface
    • A server.R file, that provides instructions to the R server
    • You should also create a readme.md file (feel free to delete this one) that contains a brief "user documentation" of your project: a brief description of the data, and explanation what are the widgets and panels doing. This file should contain a link to your project on the shinyapps server.

We hope that when you finish this project, you will good to go and start your own shiny applications!

Sidepanel

In your sidepanel, you should create at least two widgets of your choice. As stated above in the requirements, at least one of these widgets should change the data being displayed. What the other widget does is completely up to you (as long as it changes the visual representation somehow). Feel free to use whichever types of widgets you want.

Main panel

The main panel of your application should contain a visual representation of the UFO dataset. The visualization can be made with base R graphics, ggplot2, plotly, leaflet for maps or something more interesting. While we don't expect you to create anything ground-breaking, we do expect you to create a clear visualization with proper labels and titles. And of course, the graphic needs to react to changing values in the widgets.

The main panel must also have at least one summary text, such as number of observations, the name of the most common UFO shape, etc, embedded in an appropriate sentence. The summary text must be calculated from the data. For instance "Selected subset contains 1234 observations" is such a sentence, given 1234 is derived from the actual (subset of) the data.

You may also opt to present some of your visualizations as tables (but at least one must be a figure).

Submission

As with the previous assignment, you should add and commit your changes using git, and push your assignment to GitHub. In your readme file, please include a link to your shiny hosted application. You have to submit the URL of your repository to canvas--this is your submission.

Expectations

At this point in the quarter, we expect you to be following the best practices we've incorporated into the class. This means:

  • Proper use of libraries such as dplyr for data manipulation
  • Structuring your code so that if the data changes, you can easily update your entire application
  • Clearly commenting and properly organizing your code
  • Writing functions to encapsulate chunks of code that you use more than once

Ideas:

While simple distributions or maps of the data is sufficient, here are a few more advanced ideas you may consider:

  • Are UFO-s just low-flying airplanes? If so, you should see a correlation between UFO sightings and airports. Hint: package nycflights13 contains airport location data.
    (Or who knows? perhaps aliens are just more interested in airports?)
  • Perhaps alcohol plays a role with UFO sightings? If so, is there a relationship between drinking and UFO sightings? Hint: use the drinking data from A4.
  • Are there regional/seasonal differences in UFO species (shapes)?

Grading:

See the separate grading.md file

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published