-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
55 lines (36 loc) · 1.38 KB
/
server.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
41
42
43
44
45
46
47
48
49
50
source("eztree.R")
server <- function(input, output, session) {
observeEvent(input$file, {
#テーブルにて表示
csv_file <- reactive({read.csv(input$file$datapath)})
output$table <- renderTable({head(csv_file(), n = 30)})
#目的変数を選択
output$ydata <- renderUI({
selectInput("ydata", "Purpose variable", choices = colnames(csv_file()))
})
})
observeEvent(input$ydata, {
csv_file <- reactive({read.csv(input$file$datapath)})
#説明変数を選択
output$xdata <- renderUI({
checkboxGroupInput("xdata",
label = "Explanatory variable",
choices = get.explanatory(csv_file(), input$ydata),
selected = get.explanatory(csv_file(), input$ydata))
})
#手法を選択
output$method <- renderUI({
selectInput("method", "Method", choices = get.method(csv_file()[input$ydata]))
})
})
observeEvent(input$submit, {
csv_file <- reactive({read.csv(input$file$datapath)})
result <- reactive({eztree(chr2formula(y = input$ydata, x= input$xdata),
data = csv_file(),
method = get.short(input$method)
)
})
output$plot <- renderPlot({plot(result())})
output$sum <- renderPrint({(result())})
})
}