Skip to content

Commit

Permalink
add herbivory panel. Related to #16
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpelu committed Sep 18, 2023
1 parent 9b3f446 commit 4a92878
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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"))
)


Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -382,12 +391,23 @@ server <- function(input, output, session) {

output$plotcomunidad <- renderPlotly({
g <- plotCommunity(data())

g$data$especie_acomp <- paste0("<i>", g$data$especie_acomp, "</i>")

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,
Expand Down

0 comments on commit 4a92878

Please sign in to comment.