-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.R
More file actions
84 lines (73 loc) · 2.27 KB
/
app.R
File metadata and controls
84 lines (73 loc) · 2.27 KB
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
77
78
79
80
81
82
83
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(recomeristem)
library(ggplot2)
meteo = recomeristem::getMeteo_from_files("sample")
params = recomeristem::getParameters_from_files("sample")
result = recomeristem::rcpp_run_from_dataframe(params, meteo)[[1]]
# Define UI for application that draws a histogram
ui <- pageWithSidebar(
headerPanel('Ecomeristem results'),
sidebarPanel(
tabsetPanel(
tabPanel('Parameters',
dataTableOutput("mytable3")),
tabPanel('Meteo',
dataTableOutput("mytable2")),
tabPanel(
'Results',
fluidPage(
checkboxGroupInput('show_vars',
'Columns in result to show:',
names(result),
selected = names(result)),
actionLink("selectall","Select All")
)
)
)
),
mainPanel(
dataTableOutput("mytable1")
)
)
# Define server logic required to draw a histogram
server <- function(input, output, session) {
observe({
if(input$selectall == 0) return(NULL)
else if (input$selectall%%2 == 0)
{
updateCheckboxGroupInput(session,'show_vars',
'Columns in result to show:',
names(result))
}
else
{
updateCheckboxGroupInput(session,'show_vars',
'Columns in result to show:',
names(result),
selected = names(result))
}
})
# a large table, reative to input$show_vars
# customize the length drop-down menu; display 5 rows per page by default
output$mytable1 = renderDataTable({
result[, input$show_vars, drop = FALSE]
})
# sorted columns are colored now because CSS are attached to them
output$mytable2 = renderDataTable({
meteo
}, options = list(orderClasses = TRUE))
# customize the length drop-down menu; display 5 rows per page by default
output$mytable3 = renderDataTable({
params
}, options = list(lengthMenu = c(5, 30, 50), pageLength = 25))
}
# Run the application
shinyApp(ui = ui, server = server)