-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
46 lines (41 loc) · 1.55 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
# This is the server logic for a Shiny web application.
# You can find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com
#
shinyServer(function(input, output) {
output$selected_var <- renderText({
paste('Water quality data at',
input$site,'between',input$dates[1],
'and',input$dates[2])
})
output$wqplot <-renderPlot({
plotdata <- subset(buoydata,SiteName==input$site &
DateTime >= input$dates[1] &
DateTime <= input$dates[2] &
Temperature_C >=input$Temperature_C[1] &
Temperature_C <=input$Temperature_C[2] &
pH >= input$pH[1] &
pH <= input$pH[2]&
ODO_mg_L >= input$ODO_mg_L[1]&
ODO_mg_L <= input$ODO_mg_L[2]
)
ggplot(data=plotdata,aes(x=plotdata$DateTime,y=plotdata[,input$param])) +
geom_point(color='red') +
ylab('Parameter')+
xlab('Date/Time')+
ggtitle('Interactive Plot')
})
tempmod <- reactive({
plotdata <- subset(buoydata,SiteName==input$site &
DateTime >= input$dates[1] &
DateTime <= input$dates[2])
mod <- lm(plotdata$Temperature_C~plotdata[,input$param])
modsummary <- summary(mod)
return(modsummary)
})
output$modelresults <- renderText({
paste("R-Squared between Temperature and ",input$param,"
during the selected time frame:",tempmod()$r.squared)
})
})