From 4a928781f58f1b5a0bb455127a4cb4a717e45844 Mon Sep 17 00:00:00 2001 From: ajpelu Date: Tue, 19 Sep 2023 01:07:45 +0200 Subject: [PATCH] add herbivory panel. Related to #16 --- app.R | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/app.R b/app.R index 5dfe4e6..fc1da7d 100644 --- a/app.R +++ b/app.R @@ -25,6 +25,7 @@ source("R/neighborSpecies_stats.R") source("R/neighborAbundance_stats.R") source("R/diversityCommunity.R") source("R/plotCommunity.R") +source("R/herbivory.R") hojas_validas <- "data/hojas_oficiales.csv" |> read.csv() |> pull() @@ -51,7 +52,11 @@ cards <- list( vecindad = card(full_screen = TRUE, card_header("Vecindad"), plotOutput("vecindad")), comunidad = card(full_screen = TRUE, card_header("Comunidad"), - plotlyOutput("plotcomunidad")) + plotlyOutput("plotcomunidad")), + herbivoria_plot = card(full_screen = TRUE, card_header("Gráfico"), + plotlyOutput("plotherbivoria")), + herbivoria_tabla = card(full_screen = TRUE, card_header("Tabla"), + tableOutput("tablaherbivoria")) ) @@ -127,6 +132,10 @@ ui <- page_navbar( ), nav_panel("Suelos", cards[["suelos"]]), nav_panel("Biometria", cards[["biometria"]]), + nav_panel("Herbivoría", + layout_columns( + tabsetPanel(cards[["herbivoria_plot"]]), + tabsetPanel(cards[["herbivoria_tabla"]]))), nav_panel( "Vecindad", layout_columns( @@ -382,12 +391,23 @@ server <- function(input, output, session) { output$plotcomunidad <- renderPlotly({ g <- plotCommunity(data()) - g$data$especie_acomp <- paste0("", g$data$especie_acomp, "") - ggplotly(g, tooltip = "y") }) + herbivoria_calculos <- reactive({ + herbivory(data()$herbivoria) + }) + + # Herbivoria + output$plotherbivoria <- renderPlotly({ + ggplotly(herbivoria_calculos()$plot_damage) + }) + + output$tablaherbivoria <- renderTable({ + herbivoria_calculos()$damage + }) + # output$bp <- renderPlotly({ # # plot_ly(data = stats_vecindad(), y = ~n_total_vecinos,