jtrecenti commited on
Commit
e1e51f5
1 Parent(s): 242bfc3

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +4 -14
app.R CHANGED
@@ -25,27 +25,17 @@ ui <- page_fillable(theme = bs_theme(bootswatch = "minty"),
25
  )
26
 
27
  server <- function(input, output, session) {
 
28
  subsetted <- reactive({
29
  req(input$species)
30
  df |> filter(Species %in% input$species)
31
  })
32
 
33
  output$scatter <- renderPlot({
34
- p <- ggplot(subsetted(), aes(!!input$xvar, !!input$yvar)) + list(
35
- theme(legend.position = "bottom"),
36
- if (input$by_species) aes(color=Species),
37
- geom_point(),
38
- if (input$smooth) geom_smooth()
39
- )
40
-
41
- if (input$show_margins) {
42
- margin_type <- if (input$by_species) "density" else "histogram"
43
- p <- p |> ggExtra::ggMarginal(type = margin_type, margins = "both",
44
- size = 8, groupColour = input$by_species, groupFill = input$by_species)
45
- }
46
-
47
  p
48
- }, res = 100)
49
  }
50
 
51
  shinyApp(ui, server)
 
25
  )
26
 
27
  server <- function(input, output, session) {
28
+
29
  subsetted <- reactive({
30
  req(input$species)
31
  df |> filter(Species %in% input$species)
32
  })
33
 
34
  output$scatter <- renderPlot({
35
+ p <- ggplot(subsetted(), aes(.data[[input$xvar]], .data[[input$yvar]])) +
36
+ theme(legend.position = "bottom")
 
 
 
 
 
 
 
 
 
 
 
37
  p
38
+ })
39
  }
40
 
41
  shinyApp(ui, server)