Fix conditional usage of suggested packages (fs, ggalign)#62
Merged
ShixiangWang merged 5 commits intomainfrom Jan 18, 2026
Merged
Fix conditional usage of suggested packages (fs, ggalign)#62ShixiangWang merged 5 commits intomainfrom
ShixiangWang merged 5 commits intomainfrom
Conversation
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix package check issue by using namespaces conditionally
Fix conditional usage of suggested packages (fs, ggalign)
Jan 18, 2026
Addressed issues reported by devtools::check with _R_CHECK_DEPENDS_ONLY_ by updating function signatures for style consistency, wrapping examples and tests in requireNamespace checks for optional dependencies, and correcting documentation. Also updated package description and test line numbers to reflect these changes.
ShixiangWang
added a commit
that referenced
this pull request
Jan 18, 2026
* Initial plan * Add br_compare_models and br_show_forest_comparison functions Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> * Add comprehensive tests for comparison functionality Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> * Add comparison example to README Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> * Fix test failure and tidyselect deprecation warnings Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> * Refactor compare functions and remove README.html Refactored R/08-compare.R for improved code clarity and consistency, mainly adjusting whitespace and minor formatting. Deleted the generated README.html file. Updated related test files to align with the refactored code. * Replace qs with qs2 in dependencies and accessors Updated the DESCRIPTION file to suggest 'qs2' instead of 'qs'. Modified R/03-accessors.R to use 'qs2::qread' and check for 'qs2' package instead of 'qs'. This ensures compatibility with the 'qs2' package for model reading functionality. * Update 02-pipeline.R * Replace deprecated qs package with qs2 Updated code to use the qs2 package instead of the deprecated qs package. Changed function calls from qs2::qsave/qread to qs2::qs_save/qs_read in pipeline and accessor functions. Updated NEWS.md to document the change. * Increment version number to 1.4.0 * Update _pkgdown.yml * Update 08-compare.R --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> Co-authored-by: Shixiang Wang (王诗翔) <wangshx@csu.edu.cn>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CRAN check failures due to unconditional usage of packages in
Suggests. Per Writing R Extensions, suggested packages must be used conditionally withrequireNamespace()checks.Changes
fs::is_file()calls withrequireNamespace("fs", quietly = TRUE)checksfs::functions with base R fallbacks:fs::path_temp()→tempdir()fs::dir_create()→dir.create(..., recursive = TRUE, showWarnings = FALSE)fs::path()→file.path()withpaste0()for extensionsfsfromrlang::check_installed()since fallbacks are providedggalign::align_plots()with conditional check, falling back tolist(plots = valid_plots)when unavailableExample
Before:
After:
Both
ggalign::alignpatchesobjects and the fallback list provide consistent$plotsaccessor for tests.Original prompt
This section details on the original issue you should resolve
<issue_title>package check issue</issue_title>
<issue_description>Packages in Suggests should be used conditionally: see 'Writing R Extensions'
Current check issue: