Shiny HomeworkHaving 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 wellWe’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!
coronavirus <- read_csv("https://github.com/RamiKrispin/coronavirus-csv/raw/master/coronavirus_dataset.csv",
col_types = “ccddDdc”)Province.StateCountry.RegionLatLongdatecasestypeZhejiangChina29.1832120.09342020-05-090recoveredZhejiangChina29.1832120.09342020-05-100recoveredZhejiangChina29.1832120.09342020-05-110recoveredZhejiangChina29.1832120.09342020-05-120recoveredZhejiangChina29.1832120.09342020-05-130recoveredZhejiangChina29.1832120.09342020-05-140recoveredToday, we’ll build a shiny app that works with this data.
1. Make a shiny template that runsYou 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 LayoutChoose 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. TrendsOK, 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 reactiveNow, 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!
Place this order or similar order and get an amazing discount. USE Discount code “GWEXDDSRGCF10” for 10% discount
THIS QUESTION HAS BEEN ANSWERED BY OUR WRITERS
Order your custom answer