问题安装软件包“标签”和“秤”在Rstudio 2022.02.3中
我通常使用以下GGPLOT语法绘制数据:
ggplot(sent.TN.yr.avg, aes(y = (log10(mean)), x = YEAR, color = ECOREGION)) +
geom_point(size = 1, alpha = 0.4) +
geom_smooth(se=TRUE) +
xlab(expression(paste("Year"))) + ylab(expression(paste("Mean TN (", mu, "g", L^-1,")"))) +
theme_light()
但是最近这导致我进入以下loadNamespace(name)
错误:
loadNamespace(x)中的错误:没有称为'labeling'labeling'的软件包。
我不确定该代码如何引起与“标签”相关的错误。尽管如此,我还是尝试重新启动rstudio并安装它,但是此版本的Rstudio(2022.02.3)不能支持它。我还使用“秤”软件包尝试了同样的事情,并得到了相同的结果。我还尝试将存储库更改为不同的cran镜子,但没有成功。
有技巧吗?
I usually plot my data with the following ggplot syntax:
ggplot(sent.TN.yr.avg, aes(y = (log10(mean)), x = YEAR, color = ECOREGION)) +
geom_point(size = 1, alpha = 0.4) +
geom_smooth(se=TRUE) +
xlab(expression(paste("Year"))) + ylab(expression(paste("Mean TN (", mu, "g", L^-1,")"))) +
theme_light()
But this recently led me to the following loadnamespace(name)
error:
Error in loadNamespace(x) : there is no package called ‘labeling’
I'm not sure how this code prompted an error related to "labeling." Still, I tried restarting RStudio and installing that, but it cannot be supported by this version of RStudio (2022.02.3). I also tried the same thing with the "scales" package and got the same result. I've also tried changing the repository to different CRAN mirrors with no success.
Any tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
软件包ggplot2导入软件包标签的软件包量表。因此,为了使用GGPLOT,您也应该安装了其他两个软件包。
Rstudio的版本很可能与它无关。但是,如果您最近从R版本4.1切换到R4.2。
您可以在rstudio:工具 - >中执行此操作。检查包装更新...
或直接与:
update.packages(checkbuilt = true)
顺便说一句,在ggplot2页面上,有一个示例,说明如何将数学表达式插入轴标签:
https://ggplot2.tidyverse.org/articles/faq-axes.html?q = superscript#how-can-can-i-add-superscripts-and-superscripts-and-subscripts-and-subscripts-to axaxis-to-xaxis-labels
Package ggplot2 imports package scales which imports package labeling. So in order to use ggplot you should have installed the other two packages as well.
The version of RStudio most likely has nothing to do with it. But if you recently switched from R version 4.1.* to R4.2.* you have to upgrad all your installed packages (they have to be recompiled after a major R version release).
You can do this in RStudio: Tools -> Check for Package Updates...
or directly in R with:
update.packages(checkBuilt = TRUE)
By the way, on the ggplot2 page there is an example of how mathematical expressions can be inserted into axis labels:
https://ggplot2.tidyverse.org/articles/faq-axes.html?q=superscript#how-can-i-add-superscripts-and-subscripts-to-axis-labels