Data Scence Candidate
February 10, 2020
This application demonstrates how to dynamically draw bar plots by specifying the type using a radio button. To run the application click the this link and specify the graph type of your choice.
This is the R code that implements the user interface for this application.
library(shiny)
## Running Graphs with Shiny web app in interactive mode
if (interactive()) {
ui <- fluidPage(
radioButtons("dist", "Graph Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp")),
plotOutput("distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
dist <- switch(input$dist,
norm = rnorm,
unif = runif,
lnorm = rlnorm,
exp = rexp,
rnorm)
hist(dist(1000), col = "Green")
})
}
shinyApp(ui, server)
}
This application has been implemented to demonstrate the power of R in developing standalone data products. You can run this application by clicking on the link https://cyprian.shinyapps.io/TestApp/