AQ App Presentation

Carl Lee McKinney
7/17/18

Overview

This Shiny app was created as a course project for the Developing Data Products class on Coursera. Using air quality data gathered in New York, it predicts ozone levels based on user inputs of windspeed and solar radiation.

Click here to see use the app.

Click here to see the code.

User Interface

The UI code creates 2 sliders for windspeed and solar radiation inputs:

sidebarLayout(
    sidebarPanel(
       sliderInput("sliderWind",
                   "What is wind speed?",
                   min = 0,
                   max = 20,
                   value = 10),
       sliderInput("sliderSolar",
                   "What is solar radiation?",
                   min=0,
                   max=300,
                   value=150)

Server

On the server side, linear models are generated for each input, and predictions built on these models:

shinyServer(function(input,output) {
   modelWind<-lm(Ozone~Wind,data=airquality)
   modelSolar<-lm(Ozone~Solar.R,data=airquality)

   predWind<-reactive({
     windInput<-input$sliderWind
     predict(modelWind,newdata=data.frame(Wind=windInput))
   })
   predSolar<-reactive({
     solarInput<-input$sliderSolar
     predict(modelSolar,newdata=data.frame(Solar.R=solarInput))
   })

Example

Here is an example of the prediction based on windspeed set at default value of 10:

plot of chunk unnamed-chunk-3