[Rd] numeric_version doesn't like numeric versions anymore?

Sebastian Meyer @eb@meyer @end|ng |rom |@u@de
Thu Jul 6 09:52:59 CEST 2023


Please see <https://bugs.r-project.org/show_bug.cgi?id=18548> for the 
background. The documentation has always said that the input needs to be 
a character vector. Implicit conversion of numeric input to character is 
affected by R options (OutDec and scipen), but it is also error-prone in 
this context:

R> package_version("1.3") > 1.20
[1] TRUE

This now warns for a good reason in my opinion.

Best regards,

	Sebastian Meyer


Am 06.07.23 um 08:37 schrieb Dipterix Wang:
> Dear R devs,
> 
> I installed the recent devel R to test a package error when I intercept this warning when loading packages:
> 
> ```
> Warning in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) :
>    invalid non-character version specification 'x' (type: double)
> ```
> 
> After a long debugging, I realize that `numeric_version` in base does not support numerical input x by default now.
> 
> A reproducible example:
> 
> R 4.4
> 
> ```
>> numeric_version(1.5)
> Warning in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) :
>    invalid non-character version specification 'x' (type: double)
> [1] ‘1.5’
> ```
> 
> 
> R 4.3.1
> 
> ```
>> numeric_version(1.5)
> [1] ‘1.5’
> ```
> 
> According to help document, `strict=TRUE` should result in errors, then the 4.3 behavior was actually incorrect. According to pkgload maintainer, Kurt has sent him an email to fix this, suggesting this on-going change is intentional.
>   
> May I ask is there any benefit of changing the behavior?
> 
> Thanks,
> - D
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list