【发布时间】:2011-01-17 18:37:59
【问题描述】:
更新我已经在下面发布了我的解决方案,罪魁祸首是我自己的 rename 函数覆盖了 reshape::rename
直到今天,我一直在使用 ggplot R 包,没有遇到什么麻烦。今天,我使用以前工作的代码时遇到错误,当我将它调试到最小的工作示例时,它仍然会出错;
如果我这样做:
library(ggplot2)
d<- data.frame(x=1:3,y=1:3)
ggplot(data=d) + geom_line(aes(x,y))
返回如下错误:
Error in rename(x, .base_to_ggplot) :
unused argument(s) (.base_to_ggplot)
回溯是:
6: rename(x, .base_to_ggplot)
5: rename_aes(aes)
4: aes()
3: structure(list(data = data, layers = list(), scales = Scales$new(),
mapping = mapping, options = list(), coordinates = CoordCartesian$new(),
facet = FacetGrid$new(), plot_env = environment), class = "ggplot")
2: ggplot.data.frame(data = d, aes = c(x, y))
1: ggplot(data = d, aes = c(x, y))
使用rm(list=ls()) 删除所有对象后,该错误不会发生,但我仍然不清楚是什么对象导致了此错误或原因 - 我该如何解决这个问题?
有谁知道哪里出了问题?
【问题讨论】: