/
A Quick Introduction to R Shiny A Quick Introduction to R Shiny

A Quick Introduction to R Shiny - PowerPoint Presentation

tatyana-admore
tatyana-admore . @tatyana-admore
Follow
555 views
Uploaded On 2017-06-14

A Quick Introduction to R Shiny - PPT Presentation

Alec Stephenson 14 November 2013 computational informatics Presentation title Presenter name 2 Introduction Write Simple Web Applications Using Only R No Need for HTML or Javascript ID: 559545

presenter presentation shiny title presentation presenter title shiny dist input summary data output widgets server tabsets dataset alec sidebarpanel

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "A Quick Introduction to R Shiny" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

A Quick Introduction to R Shiny

Alec Stephenson

14 November 2013

computational informaticsSlide2

Presentation title | Presenter name

2 |Introduction

Write Simple Web Applications Using (Only) RNo Need for HTML or JavascriptGreat for Communication and Visualizationhttp://www.rstudio.com/shiny/showcase/

http://rstudio.github.io/shiny/tutorial/

Web Application Development Using R With Shiny

by Chris

BeeleySlide3

Presentation title | Presenter name

3 |Examples Outline

Showcase ExamplesModelling Heights & Weights of SchoolchildrenExploring DiamondsTutorial ExamplesHello Shiny: Random Samples Histogram

Widgets: Data Tables & Summaries

Tabsets

: More Random Samples

My Own Examples

Co-authorship Network

Fire Danger MapsSlide4

Presentation title | Presenter name

4 |Hello Shiny

ui.RshinyUI(pageWithSidebar(( headerPanel

,

sidebarPanel

,

mainPanel

))

server.R

shinyServer

(function(input, output) {……})Slide5

Presentation title | Presenter name

5 |Hello Shiny: ui.R

headerPanel("Hello Shiny!")sidebarPanel(sliderInput("obs

", "Number of observations:", min = 1, max = 1000, value = 500) )

mainPanel

(

plotOutput

("

distPlot

") )Slide6

Presentation title | Presenter name

6 |Hello Shiny: server.R

output$distPlot <- renderPlot({

dist <-

rnorm

(

input

$

obs

)

hist

(dist)

})Slide7

Presentation title | Presenter name

7 |Running Web Apps (Local Browser)

library(shiny)runApp("folder_name")

runExample

()

runExamples

(

"

01_hello

"

)

runExamples

(

"

07_widgets

"

)Slide8

Presentation title | Presenter name

8 |Widgets: ui.R

headerPanel("More Widgets")sidebarPanel( selectInput("

dataset

", "Choose a dataset:", choices = c("rock", "pressure", "cars")),

numericInput

("

obs

", "Number of observations to view:", 10),

helpText

("Blah

Blah

Blah

Blah

"),

submitButton

("Update View")

)Slide9

Presentation title | Presenter name

9 |Widgets: ui.R

mainPanel( h4("Summary"), verbatimTextOutput("summary"), h4("Observations"),

tableOutput

("

view

") )Slide10

Presentation title | Presenter name

10 |Widgets: server.R

datasetInput <- reactive({ switch(input$dataset, "rock" = rock, "pressure" = pressure, "cars" = cars) })

output

$

summary

<-

renderPrint

({

dataset <-

datasetInput

()

summary(dataset) })

output

$

view

<-

renderTable

({ head(

datasetInput

(), n =

input

$

obs

) })Slide11

Presentation title | Presenter name

11 |Tabsets: ui.R

headerPanel("Tabsets")sidebarPanel(

radioButtons

("

dist

", "Distribution type:", list("Normal"="norm", "Uniform" ="

unif

", "Log-normal" = "

lnorm

", "Exponential" = "exp")),

br

(),

sliderInput

("

n

", "Number of observations:", value = 500, min = 1, max = 1000) )

Slide12

Presentation title | Presenter name

12 |Tabsets: ui.R

mainPanel( tabsetPanel( tabPanel("Plot",

plotOutput

("

plot

")),

tabPanel

("Summary",

verbatimTextOutput

("

summary

")),

tabPanel

("Table",

tableOutput

("

table

")) )) Slide13

Presentation title | Presenter name

13 |Tabsets: server.R

data <- reactive({ dist <- switch(input$dist, norm =

rnorm

,

unif

=

runif

,

lnorm

=

rlnorm

, exp =

rexp

,

rnorm

); dist(

input

$

n

) })

output

$

plot

<-

renderPlot

({ dist <-

input

$

dist

; n <-

input

$

n

;

hist

(data

(), main=paste0('r', dist,

'(', n, ')'))

})

output

$

summary

<-

renderPrint

({ summary(data()) })

output

$

table

<-

renderTable

({

data.frame

(x=data()) })Slide14

Presentation title | Presenter name

14 |Conclusion

Have a go with your own dataPut your application on a web serverSend everyone the links: http://spark.rstudio.com/alec/fire/

http://spark.rstudio.com/alec/snet/Slide15

Computational informatics

Thank you

Computational Informatics

Alec Stephenson

t

+61

3 9545 8019

e

alec.stephenson@csiro.au