-
Notifications
You must be signed in to change notification settings - Fork 0
/
hodfr.R
40 lines (35 loc) · 1.43 KB
/
hodfr.R
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
# Example HODF application
#
# Run with demo('example', 'hodfr') and visit http://localhost:9755
library(hodfr)
library(shiny)
js_debug <- FALSE # Turn TRUE to enable JS debugging
shinyApp(
ui = bootstrapPage(
hodfr(
# Name of table, used to refer to it below
"demo_table",
# We want columns called "species", 3 by default.
fields = list(type = "bins", max = 3, prefix = list(name = 'species_', title = 'Species ')),
# We want rows 2000..2010
values = list(type = "year", min = 2000, max = 2010),
js_debug = js_debug),
# Example controls to show how to use output
plotOutput('plot'),
verbatimTextOutput("dataframe")),
server = function(input, output, session) {
# Populate the demo_table with some data
updateHodfrInput(session, "demo_table", data.frame(
species_1 = c(10,11,12,13,14,15,16,17,18,19,10),
species_2 = c(20,29,22,27,24,25,26,23,28,21,20),
species_3 = c(30,31,38,33,36,35,34,37,32,39,30),
row.names = 2000:2010))
# Plot all columns of demo_table whenever it changes
output$plot <- renderPlot({
plot.ts(input$demo_table)
})
# Dump demo_table into text box whenever it changes
output$dataframe <- renderPrint({
input$demo_table
})
}, options = list(host = '0.0.0.0', port = 9755))