BMCC Data in Science Worksheet

DO YOU KNOW WHY YOUR FRIENDS ARE POSTING BETTER GRADES THAN YOU? — THEY ARE PROBABLY USING OUR WRITING SERVICES. Place your order and get a quality paper today. Take advantage of our current 15% discount by using the coupon code WELCOME15.


Order a Similar Paper Order a Different Paper

Shiny Homework

Having a homework for shiny that builds through multiple steps is…kinda nuts. What I’d like you to do is save an R file for each one (prepend 1_, 2_, 3_, etc. so we know which number it is) and then zip it all up to submit. For when you post the app, give us a URL!

There are a LOT of extra credit options here. You don’t have to do them in order, or do them all. But, take a gander. This is all to help you prep for your final project!

We know this data so well

We’ve been using the coronavirus package to this point, but, while it rejiggers itself for automated data updates, let’s tap it from the source!

<code>library(readr)

coronavirus <- read_csv(<span class="hljs-string">"https://github.com/RamiKrispin/coronavirus-csv/raw/master/coronavirus_dataset.csv"</span>,
                        col_types = <span class="hljs-string">"ccddDdc"</span>)</code>
Province.State Country.Region Lat Long date cases type
Zhejiang China 29.1832 120.0934 2020-05-09 0 recovered
Zhejiang China 29.1832 120.0934 2020-05-10 0 recovered
Zhejiang China 29.1832 120.0934 2020-05-11 0 recovered
Zhejiang China 29.1832 120.0934 2020-05-12 0 recovered
Zhejiang China 29.1832 120.0934 2020-05-13 0 recovered
Zhejiang China 29.1832 120.0934 2020-05-14 0 recovered

Today, we’ll build a shiny app that works with this data.

1. Make a shiny template that runs

You know how to do this. Use Rstudio or hand-code your own template. Save it as 1_app.R. Have it load the data above (straight from the source!) Make sure that it runs.

2. Add a Layout

Choose a layout. It can be a sidebar layout, as we’ve been doing, or, try setting up something different from here. Save this as 2_app.R after making sure your app runs!

3. Got a layout? Cool. Add a theme.

There are a LOT of themes for shiny. The ones that come pre-installed are here along with a tutorial. Make your app stylin! Make sure your app runs.

3A. EXTRA CREDIT (4 POINTS) A NOVEL THEME AND LAYOUT!

Scour the web for shiny packages (seriously, just google shiny packages or other terms) to use your own unique layout and theme that is not pre-packaged. 2 poitns for theme, 2 points for layout. I’m not saying how many points we’ll give for shiny lcars….

4. Show us the data.

OK, you are all setup. Using tableOutput() in the proper place in your UI and renderTable() in your server, show us the tail of the coronavirus table. Make sure your app runs.

5. Trends

OK, now have it create a ggplot that, using plotOutput() and renderPlot() shows us the worldwide trend in confirmed cases of coronavirus. Note – you’ll have to do some data manipulation here! But you’ve done this before. Have the title tell us what date this is current to. Make sure your app runs. Note – check yourself against a dashboard like this to make sure your results are more or less correct.

6. Make it reactive

Now, add two inputs. One allows users to chose a country. The second allows them to select the type of cases to display (confirmed, death, recovered). Use whatever *Input functions you would like. Now, where you have OUTPUTS for global trends and a tail of a data table, replace them with outputs that show the trend for the selected country and type and the table for the selected country and type. Make sure your app runs.

7. Deploy your app!

Using http://shiny.umb.edu, upload your code, make sure the app works (in case you have to install any libraries), and then tell us the link! If you’ve forgotten how, go back and watch the last 10-15 minutes of our Shiny Lab!

8. Extra Credit (for full credit of another question)

Use tabsets so that all of the outputs are not returned all at once. Deploy this!

9. Map Extra Credit (for full credit of another question)

Using tmap, leafletOutput(), and renderLeaflet() (don’t worry, shiny takes care of making it interactive) add a worldmap somewhere (your choice how to do this layout – will be easier with the tabs!) that shows the final # of whatever type you have selected across a worldmap (hey, you know how to merge this data with a worldmap – maybe you have some code for it, that, for additional extra credit, you can source in!)

10. MOAR Map Extra Credit (for full credit of another question)

Set up the app so that, when you select a country, have it zoom in on the country (replot but center on that country).

11. MOAR MOAR MAP Extra Credit (for 2x full credit of another question)

Can you use information at smaller spatial scales than countries? You might have to use another spatial data source – at least a different function within rnaturalearth or from somewhere else. Either have this smaller-scale information represented on the global map OR when you select a country, plot JUST that country with smaller province/state areas as the internal borders. Good luck!

12. Even More Extra Credit (for full credit of another question)

Go wild. Do something different with this! Use other output types, use other input types, filter differently, map differently – Have fun! And tell us what you did. Deploy it. We can’t wait to see!

Do you require writing assistance from our best tutors to complete this or any other assignment? Please go ahead and place your order with us and enjoy amazing discounts.


Order a Similar Paper Order a Different Paper