# load data in 'global' chunk so it can be shared by all users of the dashboard library(shiny) library(tidyverse) library(shaRk) appDir <- system.file(package="shaRk") zooplankton <- readRDS(file.path(appDir,"zoo.rds")) %>% addDyntaxa() %>% annotateSHARK() phytoplankton <- readRDS(file.path(appDir,"phyto.rds")) %>% addDyntaxa() %>% annotateSHARK() graph_theme<- theme(axis.text.y = element_text(size=12), axis.text.x = element_text(face='plain', size=12), axis.title.y = element_text(size=14), axis.title.x = element_text(face='plain', size=10, vjust=-0.1, hjust=0.6), legend.text = element_text(size = 14))
Select your settings:
Universal
textInput("station", "Write the name of the station:", value="BY5 BORNHOLMSDJ") #selectInput("depth", "Select depth of interest", choices = unique(zooplankton$Depth))
Zooplankton
selectInput(inputId = "zoounit", label = "Unit on x-axis:", choices = unique(zooplankton$unit)) selectInput("zootaxa", "Select taxa of interest:", choices = unique(zooplankton$Genus), multiple = TRUE)
Phytoplankton
selectInput(inputId = "phytounit", label = "Unit on x-axis:", choices = unique(phytoplankton$unit)) selectInput("phytotaxa", "Select taxa of interest:", choices = unique(phytoplankton$Genus), multiple = TRUE)
Andreas Novotny Stockholm University andreas.novotny@su.se
renderPlot({ subset <- zooplankton %>% filter(unit==input$zoounit, #Depth==30, dev_stage_code!="NP", Station==input$station, Genus %in% input$zootaxa) %>% group_by(Year, Month, Day, Genus, Station, Depth) %>% summarise(Value=sum(Value)) %>% group_by(Month, Genus, Station) %>% summarise(Value=mean(Value)) ggplot(subset, aes(x = Month, y = Value, group = Genus)) + geom_line(aes(colour=Genus)) + scale_x_continuous('Month',breaks=seq(1,12,by=1),limits=c(1,12))+ # rescale Y scale_y_continuous(paste(input$zoounit))+ theme_bw() + graph_theme })
renderPlot({ subset <- phytoplankton %>% filter(unit==input$phytounit, #Depth==30, Station==input$station, Genus %in% input$phytotaxa) %>% group_by(Year, Month, Day, Genus, Station, Depth) %>% summarise(Value=sum(Value)) %>% group_by(Month, Genus, Station) %>% summarise(Value=mean(Value)) ggplot(subset, aes(x = Month, y = Value, group = Genus)) + geom_line(aes(colour=Genus)) + scale_x_continuous('Month',breaks=seq(1,12,by=1),limits=c(1,12))+ # rescale Y scale_y_continuous(paste(input$phytounit))+ theme_bw() + graph_theme }) phytoplankton$station

Available stations are:
as.data.frame(unique(zooplankton$station_name))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.