This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Get NUTS data for Belgium | |
| #' | |
| #' Downloads, caches, and parses the official Nomenclature of Territorial Units | |
| #' for Statistics (NUTS) and Local Administrative Units (LAU) data for Belgium | |
| #' from Statbel. The data includes Dutch descriptions and National Institute of | |
| #' Statistics (NIS) codes for various administrative levels. | |
| #' | |
| #' @param level A character string specifying the administrative level to | |
| #' retrieve. Must be one of `"municipalities"` (Level 4/LAU), | |
| #' `"arrodissements"` (Level 3), `"provinces"` (Level 2), `"regions"` (Level |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| readr_lazy_colnames <- function(path, delim = "|") { | |
| readr::read_delim( | |
| path, | |
| delim = delim, | |
| lazy = TRUE, | |
| progress = FALSE, | |
| show_col_types = FALSE | |
| ) |> | |
| colnames() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(etn) | |
| # Creating a connection object will result in a warning and not result in a | |
| # connection object | |
| my_con <- connect_to_etn() | |
| #> Warning: `connect_to_etn()` was deprecated in etn 2.3.0. | |
| #> ℹ You will be prompted for credentials instead. | |
| #> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was | |
| #> generated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(etn) | |
| # Creating a connection object will result in a warning and not result in a | |
| # connection object | |
| my_con <- connect_to_etn() | |
| #> Warning: `connect_to_etn()` was deprecated in etn 2.3.0. | |
| #> ℹ You will be prompted for credentials instead. | |
| #> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was | |
| #> generated. | |
| class(my_con) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Finding species that are only a single dataset and nowhere else: human | |
| # observations edition | |
| if(file.exists("query_results/0024071-251009101135966.zip")) { | |
| species_per_dataset <- | |
| readr::read_delim("query_results/0024071-251009101135966.zip") | |
| } else { | |
| species_per_dataset <- | |
| rgbif::occ_download_get("0024071-251009101135966") |> | |
| rgbif::occ_download_import() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Passerines in South America | |
| # Data read from GBIF occurrence download (SQL QUERY) | |
| pas_sa <- | |
| rgbif::occ_download_get("0028483-251009101135966") |> | |
| rgbif::occ_download_import() |> | |
| dplyr::filter(!is.na(month)) | |
| # Identify the 3 most common genera ------------------------------------- | |
| common_genera <- pas_sa |> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get all rato data as a flat csv | |
| if(!rlang::is_installed("ratatouille", version = "1.0.4")){ | |
| pak::pak("inbo/ratatouille") | |
| } | |
| library(ratatouille) | |
| # To run this function you need to store your RATO database credentials as env variables, as RATO_USER and RATO_PWD, otherwise you'll get an error. | |
| all_rato_data <- ratatouille() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return_default <- function(my_param = 50){ | |
| rlang::eval_bare(formals(rlang::caller_fn(0))[["my_param"]]) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object_name_message <- function(x){ | |
| cli::cli_inform("The object you passed is called {substitute(x)}") | |
| } | |
| object_name_message(letters) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| repo <- "my_org/my_repo" | |
| zenodo_token <- "token from url in webhook page of repo" | |
| repo_response <- | |
| httr2::request("https://api.github.com/repos") %>% | |
| httr2::req_url_path_append(repo) %>% | |
| httr2::req_perform() %>% | |
| httr2::resp_body_json() | |
| release_response <- |
NewerOlder