Shiny App that interacts with user to perform various activities.

Manish Gyawali
April 1, 2019`

About the App

This app is multifunctional. It takes 3 inbuilt datasets (iris, mtcars, eruptions) and displays the data in various forms, depening on user input.

Various shiny capabilities are demonstrated by this app, which are:

  • Dropdown menu
  • Radio Buttons
  • Slider
  • Tabset

More about the App

  • Dropdown menu: The user is given the choice of datasets for which data will be displayed or manipulated. He/she can choose either iris, mtcars or eruptions
  • Radio Buttons: Once the user has chosen the dataset, he/she can display aspects of the data either in xy-plot form or histogram form. If xy-plot is selected, a plot of the first columns vs the second column of the corresponding dataset is chosen. If histogram is chosen, only frequency of first column is displayed. An abline corresponding to the mean of the x-axis is displayed for each
  • Slider: If, and only if, histogram is chosen, the user is asked to specify the number of bins
  • Tabset: The user can use the tabset to get what aspect of the data he/she wants – summary, structure, the entire data, or the plot. If plot is chosen, the user is again directed to the choices faced in the radio buttons section

Further details

Code with basic functionality of app – I

The code demonstrates some basic capabilities of the app. In the main app, the tabular panel consits of four items which the user can navigate. Here the panel consists of only one item, the data structure.

library(shiny)
server_1 <- shinyServer(
  function(input,output,session){
  data_choice <- reactive({
        get(input$Dataset)
  })
       output$str <- renderPrint({
        str(data_choice())
    })   
}) 

Code with basic functionality of app – II

library(shiny)
ui_1 <- shinyUI(fluidPage(

  titlePanel(title = h4("Distributions", align = "centre")), 
  sidebarLayout(
    sidebarPanel(
      selectInput("Dataset", "1. Select the Dataset you want to display", 
                  choices = list("mtcars", "iris", "faithful")), 
                  br(),

      radioButtons("Plot_Type", "2. Select the Plot type", 
                   choices = list("xy-plot", "histogram")),
                  br(),
      sliderInput("bins", "3.Select the number of bins for the histogram", 
                  min = 5, max = 25, value = 15),
                  br()
      ),
    mainPanel(
      tabsetPanel(type = "tab",
        tabPanel("Summary", verbatimTextOutput("summarize")),
        tabPanel("Data", tableOutput("data")),
        tabPanel("Structure", verbatimTextOutput("str")),
        tabPanel("Plot View", plotOutput("Selected_Plot"))
      )
    )
 )
))
Error in loadNamespace(name) : there is no package called 'webshot'