Damiano Oldoni
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
      • No invitee
    • Publish Note

      Publish Note

      Everyone on the web can find and read all notes of this public team.
      Once published, notes can be searched and viewed by anyone online.
      See published notes
      Please check the box to agree to the Community Guidelines.
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
No invitee
Publish Note

Publish Note

Everyone on the web can find and read all notes of this public team.
Once published, notes can be searched and viewed by anyone online.
See published notes
Please check the box to agree to the Community Guidelines.
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# INBO CODING CLUB 24 February 2025 Welcome! ## Share your code snippet If you want to share your code snippet, copy paste your snippet within a section of three backticks (```): As an **example**: ``` library(tidyverse) ``` (*you can copy paste this example and add your code further down*) ## Yellow sticky notes No yellow sticky notes online. Put your name + " | " and add a "*" each time you solve a challenge (see below). ## Participants Name | Challenges --- | --- Damiano Oldoni | *** Dirk Maes | Jorre | Anja Leyman | *** Rhea Maesele | ** Hans Van Calster | Ward Langeraert |** Margot Vanhellemont | ** Oberon Geunens| Fleur Petersen | Raïsa Carmen | ** Pieter Verschelde | ** Falk Mielke | ** Bryce | Arno Thomaes | ** ## Challenge 1 ### Damiano's solution (example) Copy paste this section to show your solutions. ```r # dummy code print("This is how to insert code.") ``` ### Falk's attempt (This is the whole `.Rmd` file.) Based on the flexdashboard RMarkdown draft: ``` rmarkdown::draft("challenge1.Rmd", template = "flex_dashboard_bslib", package = "flexdashboard") ``` Code blocks copied from Damiano's `src` preparation. ````rmd --- title: "CrayWatch Dashboard" output: flexdashboard::flex_dashboard: vertical_layout: scroll theme: version: 4 fg: "#101010" bg: "#FDF7F7" primary: "#ED79F9" navbar-bg: "#3ADAC6" --- ```{r setup, include=FALSE} # Load libraries: library(tidyverse) # to do datascience library(here) # to work easily with paths library(sf) # to work with geospatial vector data library(leaflet) # to make dynamic maps library(DT) # to make interactive tables library(flexdashboard) # to make dashboards # Install thematic and un-comment for themed static plots (i.e., ggplot2) thematic::thematic_rmd() ``` ```{r load-data, include=FALSE} # Read data # WARNING: my local data is organized differently; adjust the path. cray_df <- readr::read_tsv( here::here("codingclub", "data", "20250224_craywatch_cleaned.txt"), na = "", guess_max = 10000 ) glimpse(cray_df) ``` Column {} ----------------------------------------------------------------------- ### Species Abundance ```{r} n_obs_per_month_species <- cray_df %>% count(year, month, species) %>% # combine year and month to a single date mutate(date = as.Date(paste0(year, "-", month, "-01"))) %>% arrange(date, species) %>% relocate(date,species, n, everything()) ggplot(n_obs_per_month_species, aes(x = date, y = n, fill = species)) + geom_bar(stat = 'identity') + # Use inferno colors for the species scale_fill_viridis_d(option = "inferno") + # Add title and labels ggtitle("Number of observations per month and species") + xlab("Date") + ylab("Number of observations") ``` ### Species Distribution ```{r} ## Chart 2 - bottom - Leaflet map #### cray_fl <- sf::st_as_sf(cray_df, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) # Create a palette that maps species to colors pal <- colorFactor("inferno", cray_fl$species) leaflet(cray_fl) %>% addTiles() %>% addCircleMarkers(popup = ~paste0(cray_fl$eventDate, ": ", cray_fl$species), color = pal(cray_fl$species), stroke = FALSE, fillOpacity = 0.5, radius = 4) %>% addLegend(pal = pal, values = ~species, position = "bottomright") ``` ```` There are **quarto dashboards!** https://quarto.org/docs/dashboards ````qmd --- title: "CrayWatch Dashboard" format: dashboard: theme: united --- <!-- themes: https://quarto.org/docs/dashboards/theming.html --> ```{r setup} #| include: false # Load libraries: library(tidyverse) # to do datascience library(here) # to work easily with paths library(sf) # to work with geospatial vector data library(leaflet) # to make dynamic maps library(DT) # to make interactive tables library(flexdashboard) # to make dashboards # Install thematic and un-comment for themed static plots (i.e., ggplot2) # thematic::thematic_qmd() ``` ```{r load-data} #| include: false # Read data cray_df <- readr::read_tsv( here::here("codingclub", "data", "20250224_craywatch_cleaned.txt"), na = "", guess_max = 10000 ) glimpse(cray_df) ``` ## Row {height=60%} ```{r} n_obs_per_month_species <- cray_df %>% count(year, month, species) %>% # combine year and month to a single date mutate(date = as.Date(paste0(year, "-", month, "-01"))) %>% arrange(date, species) %>% relocate(date,species, n, everything()) ggplot(n_obs_per_month_species, aes(x = date, y = n, fill = species)) + geom_bar(stat = 'identity') + # Use inferno colors for the species scale_fill_viridis_d(option = "inferno") + # Add title and labels ggtitle("Number of observations per month and species") + xlab("Date") + ylab("Number of observations") ``` ## Row {height=40%} ```{r} ## Chart 2 - bottom - Leaflet map #### cray_fl <- sf::st_as_sf(cray_df, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) # Create a palette that maps species to colors pal <- colorFactor("inferno", cray_fl$species) leaflet(cray_fl) %>% addTiles() %>% addCircleMarkers(popup = ~paste0(cray_fl$eventDate, ": ", cray_fl$species), color = pal(cray_fl$species), stroke = FALSE, fillOpacity = 0.5, radius = 4) %>% addLegend(pal = pal, values = ~species, position = "bottomright") ``` ```` ### Ward's attempt ````Rmd --- title: "Craywatch dashboard" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill editor_options: chunk_output_type: console --- ```{r setup, include=FALSE} # Load libraries: library(tidyverse) # to do datascience library(here) # to work easily with paths library(sf) # to work with geospatial vector data library(leaflet) # to make dynamic maps library(DT) # to make interactive tables library(flexdashboard) # to make dashboards # Read data cray_df <- readr::read_tsv( here::here("data", "20250224", "20250224_craywatch_cleaned.txt"), na = "", guess_max = 10000 ) ``` ### Number of observations ```{r} n_obs_per_month_species <- cray_df %>% count(year, month, species) %>% # combine year and month to a single date mutate(date = as_date(paste0(year, "-", month, "-01"))) %>% arrange(date, species) %>% relocate(date, species, n, everything()) ggplot(n_obs_per_month_species, aes(x = date, y = n, fill = species)) + geom_bar(stat = "identity") + # Use inferno colors for the species scale_fill_viridis_d(option = "inferno") + # Add title and labels labs(title = "Number of observations per month and species", x = "", y = "Number of observations") + scale_x_date(breaks = n_obs_per_month_species$date, date_labels = "%b") + theme_minimal() ``` ### Observations of Crayfish species ```{r} cray_fl <- sf::st_as_sf(cray_df, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) # Create a palette that maps species to colors pal <- colorFactor("inferno", cray_fl$species) leaflet(cray_fl) %>% addTiles() %>% addCircleMarkers(popup = ~paste0(cray_fl$eventDate, ": ", cray_fl$species), color = pal(cray_fl$species), stroke = FALSE, fillOpacity = 0.5, radius = 4) %>% addLegend(pal = pal, values = ~species, position = "bottomright") ``` ```` ## Challenge 2 ### Poging Anja ````rmd --- title: "Multiple pages" output: flexdashboard::flex_dashboard: theme: bg: "#101010" fg: "#FDF7F7" primary: "#ED79F9" base_font: google: Prompt code_font: google: JetBrains Mono orientation: rows vertical_layout: scroll --- ```{r setup, include=FALSE} library(flexdashboard) library(tidyverse) # to do datascience library(here) # to work easily with paths library(sf) # to work with geospatial vector data library(leaflet) # to make dynamic maps library(DT) # to make interactive tables library(flexdashboard) # to make dashboards ``` ```{r load_data, include=FALSE} # include=FALSE: code wordt gerund maar niet getoond cray_df <- readr::read_tsv( here::here("data", "20250224", "20250224_craywatch_cleaned.txt"), na = "", guess_max = 10000 ) glimpse(cray_df) ``` ```{r } # Number of observations linked to craywatch (via waarnemingen.be) dataset_name <- "Waarnemingen.be - Non-native animal occurrences in Flanders and the Brussels Capital Region, Belgium" n_obs_craywatch <- cray_df %>% filter(datasetName == dataset_name) %>% nrow() tot_obs <- nrow(cray_df) percentage_craywatch <- n_obs_craywatch / tot_obs * 100 ``` SVZ ===================================== Row --- ### <!-- 1. A gauge on top to show in percentage the number of observations linked to craywatch (= obs from waarnemingen.be dataset). In this way, we show how impactful citizen science is for detecting these species. Tip: check the gauges section in the flexdashboard documentation. --> ```{r gauge} # Number of observations linked to craywatch (via waarnemingen.be) dataset_name <- "Waarnemingen.be - Non-native animal occurrences in Flanders and the Brussels Capital Region, Belgium" n_obs_craywatch <- cray_df %>% filter(datasetName == dataset_name) %>% nrow() tot_obs <- nrow(cray_df) percentage_craywatch <- n_obs_craywatch / tot_obs * 100 gauge(percentage_craywatch, min = 0, max = 100, symbol = '%', gaugeSectors( success = c(80, 100), warning = c(40, 79), danger = c(0, 39) )) ``` ### <!-- A value box with the absolute number of observations linked to craywatch (waarnemingen.be). Use a camera as icon. Tip: check the value boxes section in the flexdashboard documentation. And if you find a way to combine the gauge and the value box next to each other, please, shout it out loudly 📢 --> ```{r valuebox} valueBox(tot_obs, icon = "fa-camera") ``` Row ----------------------------------------------------------------------- <!-- At the bottom, a histogram with the number of observations per dataset. --> ### Number of observations per dataset ```{r histo} n_obs_per_dataset <- cray_df %>% count(datasetName) ggplot(n_obs_per_dataset, aes(x = datasetName, y = n, fill = datasetName)) + geom_bar(stat = 'identity') + geom_text(aes(label = n), vjust = 0, hjust = 0) + scale_x_discrete(label = function(x) stringr::str_trunc(x, 30)) + # met dank aan Ward scale_y_continuous(limits = c(0, 1300)) + # Add title and labels # ggtitle("Number of observations per dataset") + labs(x = "", y = "Number of observations") + coord_flip() + theme(legend.position = "none") ``` Waarnemingen per maand ===================================== Row ------------------------------------- ### Number of observations ```{r histo} n_obs_per_month_species <- cray_df %>% count(year, month, species) %>% # combine year and month to a single date mutate(date = as.Date(paste0(year, "-", month, "-01"))) %>% arrange(date, species) %>% relocate(date,species, n, everything()) ggplot(n_obs_per_month_species, aes(x = date, y = n, fill = species)) + geom_bar(stat = 'identity') + # Use inferno colors for the species scale_fill_viridis_d(option = "inferno") + # Add title and labels ggtitle("Number of observations per month and species") + xlab("Date") + ylab("Number of observations") ``` Row ----------------------------------------------------------------------- ### Map ```{r} ## Chart 2 - bottom - Leaflet map #### cray_fl <- sf::st_as_sf(cray_df, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) # Create a palette that maps species to colors pal <- colorFactor("inferno", cray_fl$species) leaflet(cray_fl) %>% addTiles() %>% addCircleMarkers(popup = ~paste0(cray_fl$eventDate, ": ", cray_fl$species), color = pal(cray_fl$species), stroke = FALSE, fillOpacity = 0.5, radius = 4) %>% addLegend(pal = pal, values = ~species, position = "bottomright") ``` ````qmd ```` ### Ward's Attempt ````Rmd --- title: "Craywatch dashboard" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill editor_options: chunk_output_type: console --- ```{r setup, include=FALSE} # Load libraries: library(tidyverse) # to do datascience library(here) # to work easily with paths library(sf) # to work with geospatial vector data library(leaflet) # to make dynamic maps library(DT) # to make interactive tables library(flexdashboard) # to make dashboards # Read data cray_df <- readr::read_tsv( here::here("data", "20250224", "20250224_craywatch_cleaned.txt"), na = "", guess_max = 10000 ) ``` Crayfish distribution ===================================== ### Number of observations ```{r} n_obs_per_month_species <- cray_df %>% count(year, month, species) %>% # combine year and month to a single date mutate(date = as_date(paste0(year, "-", month, "-01"))) %>% arrange(date, species) %>% relocate(date, species, n, everything()) ggplot(n_obs_per_month_species, aes(x = date, y = n, fill = species)) + geom_bar(stat = "identity") + # Use inferno colors for the species scale_fill_viridis_d(option = "inferno") + # Add title and labels labs(title = "Number of observations per month and species", x = "", y = "Number of observations") + scale_x_date(breaks = n_obs_per_month_species$date, date_labels = "%b") + theme_minimal() ``` ### Observations of Crayfish species ```{r} cray_fl <- sf::st_as_sf(cray_df, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) # Create a palette that maps species to colors pal <- colorFactor("inferno", cray_fl$species) leaflet(cray_fl) %>% addTiles() %>% addCircleMarkers(popup = ~paste0(cray_fl$eventDate, ": ", cray_fl$species), color = pal(cray_fl$species), stroke = FALSE, fillOpacity = 0.5, radius = 4) %>% addLegend(pal = pal, values = ~species, position = "bottomright") ``` Citizen science {data-orientation=rows} ===================================== Row ------------------------------------- ### Citizen science data for detecting crayfish ```{r} dataset_name <- paste("Waarnemingen.be - Non-native animal occurrences in", "Flanders and the Brussels Capital Region, Belgium") n_obs_craywatch <- cray_df %>% filter(datasetName == dataset_name) %>% nrow() tot_obs <- nrow(cray_df) percentage_craywatch <- n_obs_craywatch / tot_obs * 100 gauge(percentage_craywatch, min = 0, max = 100, symbol = "%", gaugeSectors(success = c(80, 100), warning = c(40, 79), danger = c(0, 39)) ) ``` ### Articles per Day ```{r} valueBox(tot_obs, caption = "Number of observations linked to craywatch", icon = "ion-android-cloud-done") ``` Row ------------------------------------- ### Number of observations per dataset ```{r} cray_df %>% count(datasetName) %>% mutate(datasetName = reorder(datasetName, n)) %>% ggplot(aes(x = datasetName, y = n)) + geom_bar(stat = "identity", fill = "cornflowerblue") + geom_text(aes(label = n), vjust = 0, hjust = 0) + scale_x_discrete(label = function(x) stringr::str_trunc(x, 30)) + scale_y_continuous(limits = c(0, 1300)) + labs(x = "", y = "Number of observations") + theme_minimal() + coord_flip() ``` ```` ### Falk's Quarto Attempt ````Qmd --- title: "CrayWatch Dashboard" format: dashboard: theme: light: lux dark: solar logo: https://www.vlaanderen.be/inbo/images/INBO-logo.svg scrolling: false expandable: true nav-buttons: - icon: github href: https://coding-club.inbo.be --- <!-- themes: https://quarto.org/docs/dashboards/theming.html --> ```{r setup} #| include: false # Load libraries: library(tidyverse) # to do datascience library(here) # to work easily with paths library(sf) # to work with geospatial vector data library(leaflet) # to make dynamic maps library(DT) # to make interactive tables library(flexdashboard) # to make dashboards # Install thematic and un-comment for themed static plots (i.e., ggplot2) # thematic::thematic_qmd() # thematic does not cooperate with quarto yet https://github.com/quarto-dev/quarto-cli/discussions/9331 ``` ```{r load-data} #| include: false # Read data cray_df <- readr::read_tsv( here::here("codingclub", "data", "20250224_craywatch_cleaned.txt"), na = "", guess_max = 10000 ) glimpse(cray_df) ``` # Overview ## Row {height=25%} ```{r calculate-rates} #| include: false dataset_name <- "Waarnemingen.be - Non-native animal occurrences in Flanders and the Brussels Capital Region, Belgium" n_obs_craywatch <- cray_df %>% filter(datasetName == dataset_name) %>% nrow() tot_obs <- nrow(cray_df) percentage_craywatch <- n_obs_craywatch / tot_obs * 100 ``` ### Column {.flow} ```{r} gauge(percentage_craywatch, min = 0, max = 100, symbol = '%', gaugeSectors( success = c(0,50), warning = c(50,80), danger = c(80,100), colors = c(success = "#bd4583", warning = "#bd4583", "danger" = "#bd4583") )) ``` ### Column {.flow} <!-- https://quarto.org/docs/dashboards/data-display.html --> ```{r} #| content: valuebox #| title: "total observations" list( icon = "camera", color = "#dea3c3", value = tot_obs ) ``` ## Row {.flow} ```{r} cray_df %>% count(datasetName) %>% mutate(datasetName = reorder(datasetName, n)) %>% ggplot(aes(x = datasetName, y = n)) + geom_bar(stat = "identity", fill = "#bd4583", color = "black") + geom_text(aes(label = n), vjust = 0, hjust = 0) + scale_x_discrete(label = function(x) stringr::str_trunc(x, 30)) + scale_y_continuous(limits = c(0, 1300)) + labs(x = "", y = "Number of observations") + theme_minimal() + coord_flip() ``` # Details ## Row {height=40%, .tabset} ```{r} #| title: Species Abundance n_obs_per_month_species <- cray_df %>% count(year, month, species) %>% # combine year and month to a single date mutate(date = as.Date(paste0(year, "-", month, "-01"))) %>% arrange(date, species) %>% relocate(date,species, n, everything()) ggplot(n_obs_per_month_species, aes(x = date, y = n, fill = species)) + geom_bar(stat = 'identity') + # Use inferno colors for the species scale_fill_viridis_d(option = "inferno") + # Add title and labels ggtitle("Number of observations per month and species") + xlab("Date") + ylab("Number of observations") ``` ```{r} #| title: Species Distribution cray_fl <- sf::st_as_sf(cray_df, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) # Create a palette that maps species to colors pal <- colorFactor("inferno", cray_fl$species) leaflet(cray_fl) %>% addTiles() %>% addCircleMarkers(popup = ~paste0(cray_fl$eventDate, ": ", cray_fl$species), color = pal(cray_fl$species), stroke = FALSE, fillOpacity = 0.5, radius = 4) %>% addLegend(pal = pal, values = ~species, position = "bottomright") ``` ```` ### Poging Rhea ````rmd --- title: "Craywatch dashboard" output: flexdashboard::flex_dashboard: orientation: rows vertical_layout: scroll --- ```{r setup, include=FALSE} # Load libraries: library(tidyverse) # to do datascience library(here) # to work easily with paths library(sf) # to work with geospatial vector data library(leaflet) # to make dynamic maps library(DT) # to make interactive tables library(flexdashboard) # to make dashboards # Read data cray_df <- readr::read_tsv( here::here("data", "20250224", "20250224_craywatch_cleaned.txt"), na = "", guess_max = 10000 ) ``` Citizen Science ===================================== Column {data-width=650} ----------------------------------------------------------------------- ### Impact citizen science ```{r Gauge chart} ## Gauge chart and value box on top #### # Number of observations linked to craywatch (via waarnemingen.be) dataset_name <- "Waarnemingen.be - Non-native animal occurrences in Flanders and the Brussels Capital Region, Belgium" n_obs_craywatch <- cray_df %>% filter(datasetName == dataset_name) %>% nrow() tot_obs <- nrow(cray_df) percentage_craywatch <- n_obs_craywatch / tot_obs * 100 gauge(percentage_craywatch, min = 0, max = 100, symbol = '%', gaugeSectors( success = c(75, 100), warning = c(35, 74), danger = c(0, 34) )) ``` ### Absolute number of observations linked to Craywatch (waarnemingen.be) ```{r value box} ## Gauge chart and value box on top #### #Tip: Use camera as icon # Number of observations linked to craywatch (via waarnemingen.be) dataset_name <- "Waarnemingen.be - Non-native animal occurrences in Flanders and the Brussels Capital Region, Belgium" n_obs_craywatch <- cray_df %>% filter(datasetName == dataset_name) %>% nrow() tot_obs <- nrow(cray_df) percentage_craywatch <- n_obs_craywatch / tot_obs * 100 valueBox(tot_obs, icon = "fa-camera") ``` Column {data-width=650} ----------------------------------------------------------------------- ### Number of observations per dataset ```{r} #histogram with the number of observations per dataset short_names <- c("Waarnemingen.be - Non-native animal occurrences in Flanders and the Brussels Capital Region, Belgium" = "Waarnemingen.be", "RATO - Daily operations commissioned by the province East Flanders, Belgium" = "RATO", "Invasive species - American bullfrog (Lithobates catesbeianus) in Flanders, Belgium (post 2018)" = "IS - American bullfrog", "iNaturalist research-grade observations" = "iNaturalist", "Monitoring of fishes and crustaceans by Province East Flanders in Flanders, Belgium" = "Monitoring Province EF") cray_df %>% group_by(datasetName) %>% summarise(tot_obs_dataset = n()) %>% mutate(short_name = short_names[datasetName]) %>% ggplot() + geom_bar(aes(x = short_name, y = tot_obs_dataset), stat = 'identity') + labs(title = "Aantal observaties per dataset", x = "Dataset", y = "Aantal observaties") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) ``` Crayfishes in Flanders {data-orientation=rows} ===================================== Column {data-width=350} ----------------------------------------------------------------------- ### Plot per date (year/month) and species ```{r Chart 1} ## Chart 1 - top - Plot per date (year/month) and species #### n_obs_per_month_species <- cray_df %>% count(year, month, species) %>% # combine year and month to a single date mutate(date = as.Date(paste0(year, "-", month, "-01"))) %>% arrange(date, species) %>% relocate(date,species, n, everything()) ggplot(n_obs_per_month_species, aes(x = date, y = n, fill = species)) + geom_bar(stat = 'identity') + # Use inferno colors for the species scale_fill_viridis_d(option = "inferno") + # Add title and labels ggtitle("Number of observations per month and species") + xlab("Date") + ylab("Number of observations") ``` Column {data-width=350} ----------------------------------------------------------------------- ### Leaflet map ```{r Chart 2} ## Chart 2 - bottom - Leaflet map #### cray_fl <- sf::st_as_sf(cray_df, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) # Create a palette that maps species to colors pal <- colorFactor("inferno", cray_fl$species) leaflet(cray_fl) %>% addTiles() %>% addCircleMarkers(popup = ~paste0(cray_fl$eventDate, ": ", cray_fl$species), color = pal(cray_fl$species), stroke = FALSE, fillOpacity = 0.5, radius = 4) %>% addLegend(pal = pal, values = ~species, position = "bottomright") ``` ```` ## Challenge 3 ### Ward's attempt https://rpubs.com/wlangera/1275856 RPubs dashboard be deleted after coding club. yml header used: ``` --- title: "Craywatch dashboard" output: flexdashboard::flex_dashboard: theme: version: 4 bg: "#ffffff" fg: "#356196" primary: "#c04384" navbar-bg: "#000000" base_font: Cailibri heading_font: Sans Pro source_code: embed orientation: columns vertical_layout: fill --- ``` See screenshot example here: ![image](https://hackmd.io/_uploads/HyHA8CY9Jg.png)

Import from clipboard

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template is not available.
Upgrade
All
  • All
  • Team
No template found.

Create custom template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

How to use Slide mode

API Docs

Edit in VSCode

Install browser extension

Get in Touch

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Upgrade to Prime Plan

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

No updates to save
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Upgrade

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Upgrade

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully