Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 8, 2025

This PR implements automatic citation fetching for the cite_easystats() function, eliminating the need for manual maintenance of hardcoded citation data.

Problem

The cite_easystats() function previously relied on hardcoded citation strings and static bibliography files that required constant manual updates as package information changed. This led to outdated author lists, incorrect version numbers, and stale publication information.

Solution

The function now automatically fetches current citations using R's built-in citation() function for each package, ensuring citations are always up-to-date. The implementation includes:

  • Automatic citation generation: Uses citation(package) to get current article citations and generates software citations from package metadata
  • Improved formatting: Clean, readable citation format with "First Author et al." for packages with many authors
  • Graceful fallback: Falls back to hardcoded citations if automatic generation fails
  • Backward compatibility: Same function interface and output structure

Example

library(report)

# Now automatically generates current citations
result <- cite_easystats(packages = c("insight", "bayestestR"), format = "text")
print(result)
#> Citations
#> ----------
#> Analyses were conducted using the _easystats_ collection of packages
#> (Lüdecke et al., 2019, 2019/2025, Makowski et al., 2019, 2019/2025).
#>
#> References  
#> ----------
#> - Daniel Lüdecke et al. (2025). insight: Easy Access to Model Information
#>     for Various Model Objects [R package]. https://CRAN.R-project.org/package=insight
#> - Daniel Lüdecke, Philip Waggoner, Dominique Makowski (2019). {insight}: A Unified
#>     Interface to Access Information from Model Objects in {R}.. Journal of Open
#>     Source Software, 4(38), 1412. https://doi.org/10.21105/joss.01412
#> ...

Key Benefits

  • Always current: Citations automatically reflect the latest package information
  • Version accuracy: Shows actual installed versions (e.g., 2025 for current packages)
  • Author precision: Uses exact author information from each package's DESCRIPTION file
  • Maintenance-free: No more manual updates to hardcoded citation strings

Testing

Added comprehensive test suite (tests/testthat/test-cite_easystats_automatic.R) covering:

  • Automatic citation generation accuracy
  • Graceful handling of missing packages
  • Citation format and content validation
  • Integration with existing functionality

All tests pass ✅

Fixes #529.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits September 8, 2025 02:14
Co-authored-by: rempsyc <13123390+rempsyc@users.noreply.github.com>
Co-authored-by: rempsyc <13123390+rempsyc@users.noreply.github.com>
Co-authored-by: rempsyc <13123390+rempsyc@users.noreply.github.com>
Copilot AI changed the title [WIP] Automatically fetch updated easystats citations instead of hardcoding in cite_easystats() Automatically fetch updated easystats citations instead of hardcoding in cite_easystats() Sep 8, 2025
Copilot AI requested a review from rempsyc September 8, 2025 02:25
Copilot finished work on behalf of rempsyc September 8, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically fetch updated easystats citations instead of hardcoding in cite_easystats()

2 participants