问题描述
我在Ubuntu 14.04 64位,Rstudio 0.97.551和R 3.1.0中遇到此错误.我怀疑这是与系统环境或rstudio有关的错误,但是我提供所有详细信息以防万一.我正在使用facet_grid绘制一组图.当我使用以下使用ggplot2的表达式
I encountered this error in Ubuntu 14.04 64-bit, Rstudio 0.97.551 , R 3.1.0.I suspect this is an error that has to do with the system environment or rstudio, but I am providing all the details just in case.I am plotting a panel of plots using facet_grid. I have an irreproducible error when I use the following expression using ggplot2
censored_plot <- ggplot(aes(x=lcdm.breaks,y=value,color=diag_groups),
data=subset(stats.df, test.type %in%
c("kruskal","levene.hov","anova.homosk","anova.heterosk")))+
facet_grid(side~test.type)+geom_line()
print(censored_plot)
错误是
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'rversion' not found
Graphics error: Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'rversion' not found
由于无法再现,我的意思是我可以重复相同的表达式而不会收到该错误.好的,那不是完美的例子.所以在会议的稍后部分我有以下表达:
Ok, that wasn't the perfect example. so I had the following expressions later in the session:
> censored_plot.3 <- ggplot(aes(x=lcdm.breaks,y=value,color=diag_groups),
data=subset(stats.df,
test.type%in% c( "t.less", "t.less.holm.corr", "t.greater.holm.corr" )))+
facet_grid(side~test.type,drop=TRUE)+geom_line()
> print(censored_plot.3)
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'rversion' not found
Graphics error: Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'rversion' not found
之后
> censored_plot.3 <- ggplot(aes(x=lcdm.breaks,y=value,color=diag_groups),
data=subset(stats.df,
test.type%in% c( "t.less", "t.less.holm.corr", "t.greater.holm.corr" )))+
facet_grid(side~test.type,drop=TRUE)+geom_line()
> print(censored_plot.3)
没有错误.我得到了想要的情节
No error. I get the desired plot
万一有人得到这个错误:你并不孤单.
In case somebody else gets this error: You are not alone.
这些是导致错误的子集的组合.
我将使用%str1%来表示 ggplot(aes(x = lcdm.breaks,y = value,color = diag_groups)
用于缩短代码
these are the combinations of subsetting that caused the error.
I will use %str1% to denote ggplot(aes(x=lcdm.breaks,y=value,color=diag_groups),
for making the code shorter
> censored_plot.3 <- %str1% data=subset(stats.df,
test.type%in% c( "t.less", "t.less.holm.corr", "t.greater.holm.corr" )))+
+ facet_grid(side~test.type,drop=TRUE)+geom_point()
> print(censored_plot.3)
##No error
> censored_plot.3 <- %str1% data=subset(stats.df,
test.type%in% c( "t.less", "t.less.holm.corr", "t.greater.holm.corr" )))+
facet_grid(side~test.type,drop=TRUE)+geom_line()
> print(censored_plot.3)
##No error
> censored_plot <- %str1% data=subset(stats.df,
test.type%in% c("lillie","kruskal","anova.homosk","anova.heterosk")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot)
##No error
> censored_plot.2 <-%str1% data=subset(stats.df,
test.type%in% c("levene.hov" ,"wilcox.less", "wilcox.less.holm.corr" , "wilcox.greater.holm.corr")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot.2)
#Error
> censored_plot.3 <- %str1% data=subset(stats.df,
test.type%in% c( "t.less", "t.less.holm.corr", "t.greater.holm.corr" )))+
facet_grid(side~test.type,drop=TRUE)+geom_line()
> print(censored_plot.3)
## No error
censored_plot.lil <- %str1% data=subset(stats.df,
test.type%in% c("lillie")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot.lil)
# No error
censored_plot <- %str1% data=subset(stats.df,
test.type%in% c("kruskal","levene.hov","anova.homosk","anova.heterosk")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot)
#Error
censored_plot.2 <- %str1% data=subset(stats.df,
test.type%in% c("wilcox.less", "wilcox.less.holm.corr" , "wilcox.greater.holm.corr")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot.2)
# Error
> censored_plot.3 <- %str1% data=subset(stats.df,
test.type%in% c( "t.less", "t.less.holm.corr", "t.greater.holm.corr" )))+
facet_grid(side~test.type,drop=TRUE)+geom_line()
> print(censored_plot.3)
#Error
censored_plot.3 <- %str1% data=subset(stats.df,
test.type%in% c( "t.less", "t.less.holm.corr", "t.greater.holm.corr" )))+
facet_grid(side~test.type,drop=TRUE)+geom_line()
> print(censored_plot.3)
#no error
> censored_plot.2 <- %str1% data=subset(stats.df,
test.type%in% c("wilcox.less", "wilcox.less.holm.corr" , "wilcox.greater.holm.corr")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot.2)
#no error
> censored_plot.lil <- %str1% data=subset(stats.df,
test.type%in% c("lillie")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot.lil)
>
#no error
> censored_plot <- %str1% data=subset(stats.df,
test.type%in% c("kruskal","levene.hov","anova.homosk","anova.heterosk")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot)
# error
> censored_plot.lil <- %str1% data=subset(stats.df,
test.type%in% c("lillie")))+
facet_grid(side~test.type)+geom_line()
> print(censored_plot.lil)
#no error
> censored_plot.lil <- %str1% data=subset(stats.df,
test.type%in% c("lillie")))+
facet_grid(side~test.type)+geom_line()+scale_y_continuous(limits= c(0,1))
> print(censored_plot.lil)
#no error
我最终得到了想要的地块.但是,我仍然不知道发生了什么以及为什么我收到了不透明的错误消息.
I was able to get the plots I wanted at the end. But still, I have no clue what is going on and why I got the opaque error message.
推荐答案
直到现在我也遇到了这个问题
I also had this problem until just now
我找到了此链接,表明存在Rstudio核心问题 https://support.rstudio.com/hc/communities/public/questions/200649626-Graphics-error-when-executing-a-second-plot-aR脚本正在使用最新的R-3-0-2-补丁版本
I found this link, suggesting an Rstudio-core problemhttps://support.rstudio.com/hc/communities/public/questions/200649626-Graphics-error-when-executing-a-second-plot-from-a-R-script-using-recent-R-3-0-2-patched-versions
我升级了RStudio,并解决了该问题
I upgraded my RStudio and that resolved the issue
(我正在使用Windows,但是RStudio核心是跨平台的.我的新RStudio版本是RStudio-0.98.507.exe)
(I'm using Windows, but the RStudio core is cross-platform.My new RStudio version is RStudio-0.98.507.exe)
这篇关于R用ggplot2表达式给出奇怪的错误:找不到对象"rversion"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!