-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathShiny.Rmd
76 lines (52 loc) · 1.55 KB
/
Shiny.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
title: "Shiny"
author: "Heather Rose Kates and Richie Hodel"
date: "April 17, 2015"
output: html_document
---
========================================================
## Shiny: A web application framework for R
- Several components:
- User-interface script
- Server script
- The user's experience: to interact with a website
========================================================
## Shiny by RStudio
- Reactivity: When a user changes input,
the ui automatically changes
========================================================
## Sample ui.R code
```{r}
library(shiny)
library(ggplot2)
shinyUI(fluidPage(
mainPanel(
tabsetPanel(
tabPanel('Complete surveys',
dataTableOutput("surveys_complete"))#,
# tabPanel('Valid sea cucumber names',
# dataTableOutput("holothuriidae_nomina_valid")),
# tabPanel('sea cucumber specimens',
# dataTableOutput("holothuriidae_specimens"))
)
)
))
```
========================================================
## Sample server.R code
```{r}
library(shiny)
# Define server logic required to summarize and view the selected
# dataset
shinyServer(function(input, output) {
# a large table, reative to input$show_vars
# Most expression's in the server.R script are wrapped in a call to renderDataTable to indicate that:
#
# 1) It is "reactive" and therefore should re-execute automatically
# when inputs change
# 2) Its output type is a DataTable
output$surveys_complete = renderDataTable({
surveys_complete
})
})
```