Skip to content

Conversation

Copy link

Copilot AI commented Dec 13, 2025

PM_compare and its helper cli_df used functions from purrr, rlang, and stringr without explicit namespace prefixes, causing runtime errors when these packages weren't loaded.

Changes

  • R/PM_compare.R: Added namespace prefixes to all external function calls

    • map, map_chr, list_rbind, pluckpurrr::
    • set_namesrlang::
  • R/PMutilities.R: Fixed cli_df function (called by PM_compare)

    • map_vecpurrr::map_vec
    • str_splitstringr::str_split
  • NAMESPACE + R/Pmetrics-package.R: Added missing imports

    • purrr::map_vec, purrr::imap, purrr::list_flatten
    • stringr::str_split

Example

Previously would fail without tidyverse loaded:

# Without tidyverse loaded
result <- PM_compare(run1, run2)
# Error: could not find function "map_vec"

Now works regardless of loaded packages:

result <- PM_compare(run1, run2)  # Works
Original prompt

This section details on the original issue you should resolve

<issue_title>PM_compare uses functions that are not loaded</issue_title>
<issue_description>E.g. str_split and map_vec.

This causes an error in case tidyverse or purrr is not loaded.</issue_description>

<agent_instructions>Fix the functions so that the functions are correctly referenced and used.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits December 13, 2025 14:11
Co-authored-by: mhovd <66058642+mhovd@users.noreply.github.com>
…str_split

Co-authored-by: mhovd <66058642+mhovd@users.noreply.github.com>
Co-authored-by: mhovd <66058642+mhovd@users.noreply.github.com>
…istency

Co-authored-by: mhovd <66058642+mhovd@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix function references in PM_compare for compatibility Fix PM_compare to use explicit namespace prefixes for purrr/rlang/stringr functions Dec 13, 2025
Copilot AI requested a review from mhovd December 13, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PM_compare uses functions that are not loaded

2 participants