Dirk Eddelbuettel
2024-Oct-17 12:22 UTC
[Rd] Consider getNamespaceVersion() returning a numeric_version
On 17 October 2024 at 12:38, Tim Taylor wrote: | Would R-Core be receptive to having getNamespaceVersion() return a | numeric_version object instead of a named character? Is this good enough? What's your actual issue a 'numeric' would address? > as.package_version(getNamespaceVersion("base")) < "4.5.0" [1] TRUE > > as.package_version(getNamespaceVersion("Rcpp")) > "1.0.11" [1] TRUE > as.package_version(getNamespaceVersion("Rcpp")) > "1.0.14" [1] FALSE > Dirk -- dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Tim Taylor
2024-Oct-17 12:42 UTC
[Rd] Consider getNamespaceVersion() returning a numeric_version
I mean the `numeric_version` object not a numeric (double/int). Basically to protect me from myself I'd prefer not to have to remember to wrap `getNamespaceVersion()` with `as.package_version()`. I suspect a grep of CRAN may highlight others who are erroneously comparing character objects rather than a comparison between a `numeric_version` object and a character. Tim On 17/10/2024 13:22, Dirk Eddelbuettel wrote:> On 17 October 2024 at 12:38, Tim Taylor wrote: > | Would R-Core be receptive to having getNamespaceVersion() return a > | numeric_version object instead of a named character? > > Is this good enough? What's your actual issue a 'numeric' would address? > > > as.package_version(getNamespaceVersion("base")) < "4.5.0" > [1] TRUE > > > > as.package_version(getNamespaceVersion("Rcpp")) > "1.0.11" > [1] TRUE > > as.package_version(getNamespaceVersion("Rcpp")) > "1.0.14" > [1] FALSE > > > > Dirk >