以下是重现我的问题的代码:
library(ggplot2)
data <- data.frame(randomnums <- rnorm(50,100,200))
plot1 <- ggplot(data, aes(randomnums)) + geom_histogram()
print(plot1)
ggsave(plot1, filename="figures/plot1.pdf", width=5, height=3)
plot2 <- ggplot(data, aes(randomnums)) + geom_histogram()
print(plot2)
ggsave(plot2, filename="figures/plot2.pdf", width=5, height=3)
plot3 <- ggplot(data, aes(randomnums)) + geom_histogram()
print(plot3)
ggsave(plot3, filename="figures/plot3.pdf", width=5, height=3)
如果上面代码的每一行都是逐行运行并等待每个命令完成,那么一切正常。但是,如果我选择全部并运行,事情就会崩溃:
如果我重新启动rstudio,如果我逐行运行代码,一切都会正常工作。我错过了一个命令,以确保代码可以作为整个选择运行吗?
编辑:根据要求 - 我的会话信息。
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_0.9.3.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-1 dichromat_2.0-0 digest_0.6.3 grid_2.15.2 gtable_0.1.2 labeling_0.1
[7] lavaan_0.5-12 MASS_7.3-23 munsell_0.4 plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5
[13] reshape2_1.2.2 scales_0.2.3 stats4_2.15.2 stringr_0.6.2 tools_2.15.2
编辑:发现这只会在RStudio中中断。它适用于RGui。