My Reproducible Pitch

Paul Barry
23 April 2017

Slide One

  • This slide presentation introduces my shiny app
  • The purpose of the shiny app is to demonstrate interactive inputs and outputs in an R environment
  • It uses a user interface and a server incorporated in a single programme app.R
  • This example shiny app is based on the concept of matrix multiplication (of two matrices), and also displays a plot of the values of one matrix versus those of the second matrix, depending on the value of a boolean checkbox.

Slide Two With the code defining the two matrices

We can define two square n x n matrices in R as follows (we take n=2 here).

Amat<-matrix(c(1,2,3,4),ncol=2)
Bmat<-matrix(c(1,3,5,7),ncol=2)
Amat
     [,1] [,2]
[1,]    1    3
[2,]    2    4
Bmat
     [,1] [,2]
[1,]    1    5
[2,]    3    7

Slide Three showing the code for a matrix product

The product of Amat and Bmat in R is given by Amat %*% Bmat

Amat<-matrix(c(1,2,3,4),ncol=2)
Bmat<-matrix(c(1,3,5,7),ncol=2)
Amat%*%Bmat
     [,1] [,2]
[1,]   10   26
[2,]   14   38

Slide Four explaining the app

The app does the following.

  1. The user defines the size of the two matrices to be used (1x1 to 6x6) using an input box
  2. Two random matrices of that size are generated
  3. The product of these two matrices is calculated, when an action button is pressed
  4. Depending on a boolean input checkbox, the product of the matrices is displayed, or a plot of the values defining the second matrix versus the values of the first matrix is shown (where these values are normalized to be between 0 and 1)

Slide Five with screen shot and instructions

screenshot of the app

  1. Input the size of matrix in the top input box
  2. Toggle between showing product or plot using the checkbox
  3. Show product/plot by pressing the “Display”“ button
  4. Enjoy!