+ - 0:00:00
Notes for current slide
Notes for next slide

DSBA 5122: Visual Analytics

Class 10: Intro to Shiny

Ryan Wesslen

November 4, 2019

1 / 43

Shiny

A Shiny app is a web page (UI) connected to a computer running a live R session (Server)

Users can manipulate the UI, which will cause the server to update the UI's displays (by running R code).

2 / 43

3 / 43

4 / 43

5 / 43

Try This

  1. Open a new .R file

  2. Type this into the file. (Do you have the shiny package?)

  3. Click "Run"

6 / 43

User Interface: ui() function

7 / 43

fluidPage()

8 / 43

Example

9 / 43

Example

10 / 43

Input Syntax

11 / 43

Inputs

There are multiple common Input() functions.

12 / 43

What's in an Input function? HTML

13 / 43

Output Syntax

14 / 43

Output Options

15 / 43

Example

16 / 43

Example

17 / 43

Example

18 / 43

Example

19 / 43

Layouts

20 / 43

sidebarLayout()

21 / 43

sidebarLayout()

22 / 43

sidebarLayout()

23 / 43

html tags if you know HTML

24 / 43

Server: server() function

25 / 43

26 / 43

27 / 43

28 / 43

29 / 43

30 / 43

31 / 43

32 / 43

33 / 43

34 / 43

35 / 43

Shiny: Output

36 / 43

Server Recap

37 / 43

15 minute Quick Assignment

Open the app.R file.

Try these three tasks:

  1. add a new slider that sets the number of breaks for the rnorm() function

  2. add a textInput() that sets the name of the plot

  3. add a actionButton() that updates the name of the plot (part 2) only when clicking (hint: see ?observeEvent)

38 / 43

Deploying Apps to Shinyapps.io

39 / 43

Setup connection to ShinyApps.io

40 / 43

Setup connection to ShinyApps.io

41 / 43

Deploy to ShinyApps.io

42 / 43

Deploy to ShinyApps.io

43 / 43

Shiny

A Shiny app is a web page (UI) connected to a computer running a live R session (Server)

Users can manipulate the UI, which will cause the server to update the UI's displays (by running R code).

2 / 43
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow