知道包是在哪个(确切的)R 版本下构建的?

Know which (exact) R version a package was built under?

我们如何准确判断 R 包是在哪个 R 版本下构建的?

例子

在 RSelenium 包的 DESCRIPTION 文件 here 中,我们看到

Depends:
    R (>= 3.0.0)

但这似乎并不准确(由于 > 符号)

注释

Karl Browman 的网站says

Depends is used to indicate dependency on a particular version of R, and on packages that are to be loaded (with library()) whenever your package is loaded. If you expect that users would want to load that other package whenever they loaded yours, then you should include the package name here. But this is now relatively rare. (I think the namespaces for these packages should also be imported, with @import.)

构建包的版本几乎无关紧要。通常唯一重要的是安装了哪个版本。 (二进制包是已安装包的映像,因此对它们很重要。)

安装包的版本存储在 DESCRIPTION 文件的 Built: 字段中。 (是的,"Built",不是 "Installed"。) 您可以使用

之类的代码查看它
read.dcf(system.file("DESCRIPTION", package="base"), fields="Built")
#>      Built                                     
#> [1,] "R 3.6.1; ; 2019-07-06 02:01:41 UTC; unix"

输入你自己的包名而不是"base"

"almost never matters" 的例外情况是在包格式更改的极少数情况下。