library(magrittr)
rmi_url <- "https://opendata.meteo.be/ftp/observations/radar/vbird/denhb/2024/denhb_vpts_20240128.txt"
header <- readr::read_lines(rmi_url) %>%
.[stringr::str_starts(.,"#")] %>%
tail(1) %>%
stringr::str_remove("#") %>%
stringr::str_split(" ", simplify = TRUE) %>%
.[nchar(.) > 0]
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 <- |
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
ripple_shuffle <- function(object) { | |
purrr::map( | |
seq(1, length(object) / 2), | |
~ c( | |
purrr::chuck(object, .x), | |
purrr::chuck(object, length(object) - .x + 1) | |
) | |
) %>% | |
unlist() | |
} |
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_inat_obs_radius <- function(taxon_id, lat, lng, radius) { | |
api_response <- httr2::request( | |
"https://api.inaturalist.org/v1/observations/" | |
) %>% | |
httr2::req_url_query( | |
taxon_id = taxon_id, | |
lat = lat, | |
lng = lng, | |
radius = radius | |
) %>% |
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(dplyr) | |
# Ensure ETN API-beta version | |
remotes::install_github("inbo/[email protected]") | |
library(etn) | |
# Get number of detections, species and animals for lifewatch presentation | |
project_codes_to_investigate <- c( | |
"2010_PHD_REUBENS", | |
"2011_RIVIERPRIK", | |
"2012_LEOPOLDKANAAL", |
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
# We are trying to find the closest allele per gene | |
## You could possibly do this with this package as well: | |
## https://bioconductor.org/packages/release/bioc/vignettes/GenomicRanges/inst/doc/GenomicRangesIntroduction.html#finding-the-nearest-genomic-position-in-granges-objects | |
library(dplyr) # A Grammar of Data Manipulation | |
library(assertthat) # Easy Pre and Post Assertions | |
# Some example data |
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
cli::cli_abort("Friend{?s}: {zwoog}", | |
.envir = rlang::new_environment( | |
data = list(zwoog = c("Luc","Tendi") | |
) | |
) | |
) | |
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
httr2::request("https://raw.githubusercontent.com/enram/aloftdata.eu/refs/heads/main/_data/OPERA_RADARS_DB.json") |> | |
httr2::req_perform() |> | |
httr2::resp_body_json(check_type = FALSE) |> | |
purrr::map(~dplyr::tibble( | |
number = .x$number, | |
country = .x$country, | |
countryid = .x$countryid, | |
oldcountryid = .x$oldcountryid, | |
wmocode = .x$wmocode, | |
odimcode = .x$odimcode, |
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(dplyr) | |
# Which package to check | |
trias_namespace <- asNamespace("trias") | |
# Character vector of all functions and their arguments, print method of base ls with str() on every object | |
trias_fns_args <- capture.output(utils::lsf.str(trias_namespace)) | |
# Extract the functions |
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
round_coordinates <- function(wkt_string, digits = 4) { | |
wkt_object_type <- wkt_string %>% | |
stringr::str_extract(".*?(?=\\()") | |
x_coord <- wkt_string %>% | |
stringr::str_extract("(?<=POINT\\()[0-9]+\\.[0-9]+") %>% | |
as.numeric() | |
y_coord <- wkt_string %>% | |
stringr::str_extract("[0-9]+\\.[0-9]+(?=\\))") %>% |
NewerOlder