简体   繁体   English

ggplot2 无法加载,出现“rlang”包错误

[英]ggplot2 fails to load, with 'rlang' package error

This is the error message:这是错误消息:

Error: package or namespace load failed for 'ggplot2' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace 'rlang' 0.3.4 is already loaded, but >= 0.4.0 is required错误:loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) 中的“ggplot2”的包或命名空间加载失败:命名空间“rlang”0.3.4 已经加载,但是>= 0.4.0 是必需的

In addition to a Warning message:除了警告消息:

package 'ggplot2' was built under R version 3.6.1包“ggplot2”是在 R 版本 3.6.1 下构建的

Please help.请帮忙。 Thanks a lot.非常感谢。

Just providing a more complete answer for people to follow.只是为人们提供更完整的答案。

Remove packages with删除包

remove.packages("rlang")

That may not work as you may need to delete the package from your R library.这可能不起作用,因为您可能需要从 R 库中删除包。 To find where you R library is run查找运行 R 库的位置

.libPaths()

Once you've deleted the rlang folder from there you can restart R and run从那里删除 rlang 文件夹后,您可以重新启动 R 并运行

install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.4.9.tar.gz", repo=NULL, type="source") # for specific rlang version, in this case 0.4.9. For latest version can run install.packages("rlang")
packageVersion("rlang") #to check you now have rlang version you want

Figured just a slight modification to the first answer worked best for me: restart R, then:认为对第一个答案的轻微修改最适合我:重新启动 R,然后:

remove.packages("rlang") remove.packages("dplyr") remove.packages("rlang") remove.packages("dplyr")

install.packages("rlang") install.packages("dplyr") install.packages("rlang") install.packages("dplyr")

library(rlang) library(dplyr)库(rlang) 库(dplyr)

My solution is to restart R and then update all the packages.我的解决方案是重新启动 R ,然后更新所有包。

update.packages(ask = FALSE)

The problem with just removing & installing rlang , and then your desired package (here ggplot2 ), you might find there are other packages you have remove and install.仅删除和安装rlang的问题,然后是您想要的软件包(此处ggplot2 ),您可能会发现您已经删除并安装了其他软件包。 Best to update all and save time.最好全部更新并节省时间。

通过更新 R 和 Rstudio、删除“rlang”包并重新安装包、删除“ggplot2”包并重新安装包来解决问题。

只需更新你的 R 包,因为 ggplot2 包中有一个新的更新支持更高的 R 版本,它应该是 3.6.3 和更高版本!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ggplot2 无法加载 - ggplot2 fails to load ggplot2软件包无法加载 - ggplot2 package failing to load 错误:package 或 ggplot2 和 data.table 的命名空间加载失败 - Error: package or namespace load failed for ggplot2 and for data.table PowerBI Desktop 和 R 错误:“ggplot2”的包或命名空间加载失败 - PowerBI Desktop and R Error: package or namespace load failed for 'ggplot2' 错误:package 或“tidyverse”的命名空间加载失败,没有名为“rlang”的 package - Error: package or namespace load failed for “tidyverse” there is no package called “rlang” 错误:“ggplot2”的包或命名空间加载失败:包“ggplot2”是在 R 4.0.0 之前安装的:请重新安装执行停止 - Error: package or namespace load failed for 'ggplot2': package 'ggplot2' was installed before R 4.0.0: please re-install it Execution halted R 3.4.2 库中的错误(ggplot2):没有名为“ggplot2”的包 - R 3.4.2 Error in library(ggplot2) : There is no package called 'ggplot2' 库中的错误(ggplot2):没有名为“ggplot2”的包执行停止 - Error in library(ggplot2) : there is no package called ‘ggplot2’ Execution halted 加载 ggplot2 时抛出错误:package 或命名空间加载失败....没有 package 称为“颜色空间” - Loading ggplot2 throwing the Error: package or namespace load failed .... there is no package called ‘colorspace’ 在R中安装ggp​​lot2软件包时出错 - Error in installing ggplot2 package in R
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM