Shiny - exercises

Building a Shiny App

1. Copy, debug and run the first application (app1) presented today.

2. Bin numbers: Change the application app1 to allow the user to enter the numbers of bins when plotting the histogram

3. Server response: Change the application app1 to add some text as a response from server

4. Mean and Stdv: Change app1 so that

  • The user can enter different values for the mean and standard deviation
  • The mean and standard deviation are shown in the mainPanel
  • The user can enter a title for the histogram

5. Different displays: Change app1 so that the user can choose to do a histogram or a boxplot

6. Do it the way you want it: Just about anything can be made to look the way you want it.

  • change the size of the sidebar (,width=3)
  • Change the aspect ratio of the graph plotOutput("plot", width ="500px", height = "500px")

7. Panel appears and disappears:

An ugly feature of our app: the input field Number of bins only makes sense for the histogram, not for the boxplot, so it should not appear when we do a boxplot.

Hint: use a conditionalPanel()

8. Predefined data sets

Let us read files on the server files, for example newcomb.R. For this purpose, first we need
to save the data sets in the same folder as ui.R and server.R, say
with dump

Then we can read the data in the server with

if(input$dataset=="Newcomb's Speed of Light") {



Last modified: Monday, 10 February 2020, 1:52 PM