-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
57 lines (52 loc) · 1.27 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
51
52
53
54
55
56
57
packages = c('xlsx', 'vegan', 'pvclust')
for (p in setdiff(packages, installed.packages()[, 'Package'])) {
install.packages(p, dependencies = T)
}
require(xlsx)
require(vegan)
function(input, output) {
observeEvent(input$btn_calcular, {
df <-
read.xlsx(
input$file1$datapath,
sheetIndex = 1,
encoding = "UTF-8",
row.names = 1
)
fig = plot(
hclust(
vegdist(df, method = input$method.s, binary = T),
method = input$method.a
),
hang = -1,
main = "",
ylab = input$method.s
)
output$input_data <- renderTable({
return(format(round(df, 1)))
}, rownames = TRUE)
output$results <- renderPlot({
input$btn_calcular
plot(
hclust(
vegdist(df, method = input$method.s, binary = input$binary),
method = input$method.a
),
hang = -1,
main = "",
ylab = input$method.s
)
png(filename = paste0(input$method.s,"_", input$method.a, ".png"))
plot(
hclust(
vegdist(df, method = input$method.s, binary = T),
method = input$method.a
),
hang = -1,
main = "",
ylab = input$method.s
)
dev.off()
})
})
}