首页 > 解决方案 > 用于安装软件包的 R 版本记录在哪里?

问题描述

R> library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’:
 package ‘ggplot2’ was installed before R 4.0.0: please re-install it

R 知道已安装软件包的安装版本。

~/Library/R/4.0/library/ggplot2中有以下文件。有人知道哪个文件包含用于安装的 R 版本吗?谢谢。

./CITATION
./LICENSE
./NEWS.md
./R/ggplot2.rdx
./R/ggplot2.rdb
./R/ggplot2
./Meta/vignette.rds
./Meta/data.rds
./Meta/links.rds
./Meta/features.rds
./Meta/nsInfo.rds
./Meta/package.rds
./Meta/hsearch.rds
./Meta/Rd.rds
./NAMESPACE
./html/R.css
./html/00Index.html
./DESCRIPTION
./INDEX
./doc/index.html
./doc/ggplot2-specs.R
./doc/extending-ggplot2.Rmd
./doc/extending-ggplot2.R
./doc/ggplot2-in-packages.R
./doc/ggplot2-specs.Rmd
./doc/ggplot2-in-packages.html
./doc/ggplot2-in-packages.Rmd
./doc/extending-ggplot2.html
./doc/ggplot2-specs.html
./data/Rdata.rds
./data/Rdata.rdx
./data/Rdata.rdb
./help/ggplot2.rdx
./help/ggplot2.rdb
./help/AnIndex
./help/aliases.rds
./help/paths.rds
./help/figures/logo.png
./help/figures/README-example-1.png

标签: r

解决方案


./Meta/package.rds 包含有关构建包的 R 版本的信息。这是我当前运行 3.4.1 的机器上的 yaml 包的示例

> # Working directory already set to the Meta folder of the package
> meta <- readRDS("package.rds")
> meta$Built
$R
[1] ‘3.4.2’

$Platform
[1] "x86_64-w64-mingw32"

$Date
[1] "2017-11-19 09:58:14 UTC"

$OStype
[1] "windows"

推荐阅读