GithubHelp home page GithubHelp logo

Comments (6)

agila5 avatar agila5 commented on September 25, 2024

Unfortunately, for the time being, I cannot replicate the error... Tomorrow I will try again!

from sfnetworks.

agila5 avatar agila5 commented on September 25, 2024

I'm pretty sure that the problem lies in the following lines of code

sfnetworks/R/spatstat.R

Lines 17 to 18 in 23a4125

spst_ver = try(packageVersion("spatstat"), silent = TRUE)
if (!inherits(spst_ver, "try-error") && spst_ver < 2.0-0) {

where we are comparing the object spts_ver with the number 2.0-0. More precisely, the object spts_ver created by packageVersion("spatstat") is an object of class c("package_version", "numeric_version") and comparisons with other objects are performed by Ops.numeric_version

Ops.numeric_version
#> function (e1, e2) 
#> {
#>     if (nargs() == 1L) 
#>         stop(gettextf("unary '%s' not defined for \"numeric_version\" objects", 
#>             .Generic), domain = NA)
#>     boolean <- switch(.Generic, `<` = , `>` = , `==` = , `!=` = , 
#>         `<=` = , `>=` = TRUE, FALSE)
#>     if (!boolean) 
#>         stop(gettextf("'%s' not defined for \"numeric_version\" objects", 
#>             .Generic), domain = NA)
#>     if (!is.numeric_version(e1)) 
#>         e1 <- as.numeric_version(e1)
#>     if (!is.numeric_version(e2)) 
#>         e2 <- as.numeric_version(e2)
#>     op <- get(.Generic, mode = "function")
#>     op(.Internal(compareNumericVersion(e1, e2)), 0L)
#> }
#> <bytecode: 0x00000210253d3f10>
#> <environment: namespace:base>

Created on 2024-03-28 with reprex v2.0.2

According to the traceback reported on CRAN, this function runs smoothly until it computes base::as.numeric_version(e2) (where e2 is equal to 2 - 0 as we can read from the previous line in the traceback). The function base::as.numeric_version() internally calls base::numeric_version() which internally calls .make_numeric_version(). The function .make_numeric_version() was recently modified by the R-core team (see wch/r-source@1338a95 and https://bugs.r-project.org/show_bug.cgi?id=18548) and, even more recently, they decided to always raise an error on invalid numeric version, see wch/r-source@7b52372. Therefore, IMO, we should simply modify 2.0-0 to "2.0-0" (which is probably the code always intended when comparing version numbers).

I'm 99.99% sure that the aforementioned explanation is correct. However:

  1. I cannot replicate the aforementioned error using the GHA. Would you mind checking the R-CMD-check.yaml file in the develop branch?
  2. I just noticed that we do not have any explicit dependency on spatstat (as a consequence of 0c551e4). Therefore, I don't really understand how it is possible that try(packageVersion("spatstat"), silent = TRUE) returns a valid numeric_version object (instead of an object of class try-error) and, as a consequence, I don't understand how is it possible that R ran the second part of the following if-clause during the CRAN checks detecting our error:

    sfnetworks/R/spatstat.R

    Lines 17 to 18 in 23a4125

    spst_ver = try(packageVersion("spatstat"), silent = TRUE)
    if (!inherits(spst_ver, "try-error") && spst_ver < 2.0-0) {

    Any idea? Please notice that we are currently suggesting spatstat.geom and spatstat.linnet, but they do not have an explicit dependency on spatstat. In fact:
pak::pkg_deps_explain("sfnetworks", "spatstat.geom", dependencies = TRUE)
#> ℹ Loading metadata database✔ Loading metadata database ... done
#> sfnetworks -> spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.random -> spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.explore -> spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.explore -> spatstat.random ->
#>   spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.model -> spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.model -> spatstat.random ->
#>   spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.model -> spatstat.explore ->
#>   spatstat.geom
#> sfnetworks -> spatstat.linnet -> spatstat.model -> spatstat.explore ->
#>   spatstat.random -> spatstat.geom
pak::pkg_deps_explain("sfnetworks", "spatstat.linnet", dependencies = TRUE)
#> sfnetworks -> spatstat.linnet
pak::pkg_deps_explain("sfnetworks", "spatstat", dependencies = TRUE)
#> x spatstat

Created on 2024-03-28 with reprex v2.0.2

from sfnetworks.

agila5 avatar agila5 commented on September 25, 2024

Answers:

  1. I'm pretty sure that I correctly identified the error and I will prepare a PR in a few minutes
  2. Apparently my assumptions were incorrect, meaning that R CMD check can still "access" the packages in the library even if they are not specified under Imports or Suggests

from sfnetworks.

agila5 avatar agila5 commented on September 25, 2024

Hi @luukvdmeer. Friendly remainder that the deadline for the resubmission is 2024-04-09!

from sfnetworks.

luukvdmeer avatar luukvdmeer commented on September 25, 2024

Yes, I am aware, I'm looking at it today, thanks!

from sfnetworks.

loreabad6 avatar loreabad6 commented on September 25, 2024

Thank you for this! sfnetworks 0.6.4. is on CRAN 😄

from sfnetworks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.