There is a newer version of the record available.

Published March 9, 2026 | Version v.1.1.0
Software Open

sharksmhi/SHARK4R: v.1.1.0

  • 1. SMHI

Description

New features

  • Added get_nua_media_metadata() to retrieve detailed metadata for media items from Nordic Microalgae
  • Added get_nua_image_labeling_links() to retrieve media URLs for automated imaging images (e.g., IFCB) from Nordic Microalgae
  • Added get_nua_image_labeling_metadata() to retrieve detailed metadata for automated imaging images from Nordic Microalgae

Security improvements

  • load_shark4r_fields() now downloads field definitions as a binary .rds file instead of sourcing a remote R script, eliminating a remote code execution risk.
  • get_shark_data() now validates that file_path does not contain .. path components, preventing path traversal when used in downstream applications.
  • get_shark_datasets() now sanitizes dataset names from the API with basename() before writing to disk.

Bug fixes and CRAN compliance

  • Fixed species not getting properly matched in match_algaebase_taxa(). The join between API results and input data used left_join(by = c("genus", "species")), which silently dropped results when AlgaeBase returned a reclassified genus (e.g., querying "Chlorella" but API returns "Auxenochlorella"). (Part of #47)
  • Fixed match_algaebase_genus() returning unrelated genera when exact_matches_only = TRUE. A variable shadowing bug inside tibble() caused the input_match column to always equal 1, making the exact match filter ineffective. For example, querying "Nitzschia" returned 7 genera (Cymbellonitzschia, Pseudo-nitzschia, etc.) instead of just Nitzschia. (Part of #47)
  • Fixed genus column collision in match_algaebase_species(). When higher taxonomy was requested, genus = genus_taxonomy$genus was included in the taxonomy tibble, which could overwrite the species-level genus value. (Part of #47)
  • Removed genus fallback in match_algaebase_taxa() for species-level queries. Previously, when a species was not found in AlgaeBase, the function fell back to a genus-level query. This produced misleading results where a species record linked to an unrelated genus page. Species queries that fail now return NA instead. (Part of #47)
  • Fixed get_dyntaxa_records() silently returning a character string on API error instead of raising a condition with stop().
  • Fixed get_shark_data() silently dropping municipalities, waterCategories, and typOmraden parameters when computing the pre-download row count, which could bypass the chunked download path.
  • Fixed operator precedence bug nrow(genus > 0) to nrow(genus) > 0 in construct_dyntaxa_missing_table().
  • Replaced unsafe 1:length() and 1:nrow() loops with seq_along() and seq_len() in construct_dyntaxa_missing_table() and construct_dyntaxa_table() to prevent errors on zero-length input.
  • Replaced message("ERROR: ...") calls with warning() in check_value_logical(), check_zero_value(), check_zero_positions(), check_codes(), and read_shark_deliv() so conditions can be caught programmatically with tryCatch().
  • Removed duplicate cachefile assignment in cache_call() and dead list.files() call in list_cache().
  • All internal cache paths now use the cache_dir() helper, which redirects to tempdir() during R CMD check. Previously several functions called tools::R_user_dir() directly, which could create ~/.cache/R/SHARK4R during CRAN checks.
  • Fixed evaluation order bug in clean_shark4r_cache() where search_pattern = NULL (the default) could cause an error.
  • Fixed deprecation warning version numbers in algaebase functions (now correctly reference 1.0.0).
  • Fixed spelling of "Microalgae" and other minor typos in get_hab_list() documentation.
  • get_hab_list() updated to wrap inline text with I() in readr::read_delim() for readr ≥ 2.2.0 compatibility and to remove deprecation warnings.
  • Tests that depend on the OBIS xylookup API now skip correctly when the endpoint returns a server error. Previously, the availability check targeted the base URL (https://api.obis.org/) which could return 200 while the /xylookup endpoint itself returned 500.
  • All \donttest{} examples that call external APIs are now wrapped with try() so that transient service outages do not cause R CMD check --run-donttest failures.
  • The quality_control vignette now wraps OBIS-dependent calls (check_onland(), check_depth()) in tryCatch() so the vignette builds even when the API is unavailable.

What's Changed

  • make sure cache is cleared after cmd check by @anderstorstensson in https://github.com/sharksmhi/SHARK4R/pull/45
  • fix typo in deprecate warning message by @anderstorstensson in https://github.com/sharksmhi/SHARK4R/pull/46
  • Add functions for the new nua api endpoints by @anderstorstensson in https://github.com/sharksmhi/SHARK4R/pull/49
  • 47 species not getting properly matched in algaebase by @anderstorstensson in https://github.com/sharksmhi/SHARK4R/pull/48
  • fix test warnings and update NEWS by @anderstorstensson in https://github.com/sharksmhi/SHARK4R/pull/50
  • add copyright_stamp to output by @anderstorstensson in https://github.com/sharksmhi/SHARK4R/pull/51
  • fix: make sure tests/vignettes skip or fail gracefully during transie… by @anderstorstensson in https://github.com/sharksmhi/SHARK4R/pull/52

Full Changelog: https://github.com/sharksmhi/SHARK4R/compare/v.1.0.3...v.1.1.0

Files

sharksmhi/SHARK4R-v.1.1.0.zip

Files (989.5 kB)

Name Size Download all
md5:dfddd4a9cfa4b6141c6e6bdd23c825cf
989.5 kB Preview Download

Additional details

Related works

Software