Skip to content

R CMD check: two standing NOTEs (unused sf import, .data/.env globals) #111

Description

@NewGraphEnvironment

If we do it: R CMD check on the package is NOTE-free, so a new NOTE is a signal. If we never do: two standing NOTEs hide the next one, as the five NOTEs from #100 hid each other.

Problem

R CMD check --no-manual --ignore-vignettes on the v0.5.6 tarball, built with the #100 .Rbuildignore change, reports 2 NOTEs (measured 2026-10-01, _R_CHECK_FORCE_SUGGESTS_=false). #100 cleared the other 3. These 2 are not caused by #100, and nothing tracks them:

* checking dependencies in R code ... NOTE
Namespace in Imports field not imported from: 'sf'
* checking R code for possible problems ... NOTE
cd_baseline / cd_compare / cd_plot_comparison / cd_plot_timeseries / cd_summary:
  no visible binding for global variable '.data' (cd_summary also '.env')
  • NAMESPACE has no import or importFrom lines at all. Code uses the .data and .env pronouns unqualified, and never imports them from rlang.
  • sf is in Imports, but no R code calls it. Outside @examples, the only reference is inherits(aoi, "sf") in R/cd_crop.R:30, which does not need the namespace.

Proposed Solution

  • Add @importFrom rlang .data .env to a package-level doc (R/cd-package.R), per the r-package convention.
  • Decide where sf belongs. It could move to Suggests: the examples call sf::st_read(), and cd_crop() only checks the class. Or it could stay in Imports with a real import, if an sf input should guarantee sf is loaded for the terra::vect() conversion. Check how cd_crop() turns an sf object into a SpatVector before choosing.
  • Re-run R CMD check and confirm 0 NOTEs.

Resolution

Landed in #114. Decided: sf moves to Suggests. cd_crop() hands an sf AOI to terra::vect(), and terra 1.9.50 converts it through methods::as(x, "SpatVector"), which loads sf when it is needed (checked in a session with sf not loaded). Anyone holding an sf object therefore already has sf. The 8 tests that read their AOI with sf::st_read() now skip_if_not_installed("sf"). R CMD check is Status OK, 0 NOTEs. The one change users see: pak::pak("NewGraphEnvironment/cd") no longer installs sf.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions