-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.R
60 lines (56 loc) · 1.22 KB
/
app.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
58
59
60
library(bs4Dash)
library(dplyr)
library(fst)
library(ggplot2)
library(shiny)
body <- bs4DashBody(
fluidRow(
column(
4,
bs4Sortable(
width = 12,
bs4Card(
title = "Model",
width = 12,
status = "primary",
closable = FALSE,
selectInput("model", "", c("continuous", "discrete"))
),
bs4Card(
title = "Value",
width = 12,
status = "primary",
closable = FALSE,
selectInput("value", "", c("mean", "median"))
)
)
),
shiny::column(
8,
bs4Card(
title = "Plot",
width = 12,
status = "success",
closable = FALSE,
plotOutput("plot", height = "600px")
)
)
)
)
ui <- bs4DashPage(
title = "MCMC Results",
body = body,
sidebar = bs4DashSidebar(disable = TRUE)
)
server <- function(input, output) {
results <- read_fst("results.fst")
output$plot <- renderPlot({
results %>%
filter(model == input$model) %>%
ggplot(.) +
geom_point(aes_string(x = "beta_true", y = input$value)) +
geom_abline(slope = 1, intercept = 0) +
theme_gray(16)
})
}
shinyApp(ui = ui, server = server)