Aug 23,2017

Introduction

In this project we were required to write a shiny application with associated supporting documentation. This documentation should be thought of as whatever a user will need to get started using this application.

Server Code

library(shiny)

shinyServer(function(input, output) {

output$distPlot <- renderPlot({

# generate bins based on input$bins from ui.R
#hist(rnorm(input$obs))
x    <- quakes$depth[quakes$mag>input$obs-0.3  & quakes$mag<input$obs+0.3] 
#bins <- seq(min(x), max(x), length.out = input$bins + 1)

# draw the histogram with the specified number of bins
#hist(x, breaks = bins, col = 'darkgray', border = 'white')

plot(x,pch=22, lty=2, col="red",xlab = "Depth in KM",ylab = "",main = "Richter Magnitude VS Depth(KM)")

})

})

UI code

library(shiny)

shinyUI(fluidPage(

# Application title titlePanel("Scatter Plot for Impact of earthquake to surrounding area."),

# Sidebar with a slider input for number of Cylinders sidebarLayout( sidebarPanel(

  sliderInput("obs", "Block:",
              min = min(quakes$mag), max = max(quakes$mag),step = 0.3, value = mean(quakes$mag)
  )
   
),

# Show a plot of the generated distribution
mainPanel(
   plotOutput("distPlot")
)

) ))

Demo