我在iMac上使用最新版本的Rstudio
版本1.0.44 - © 2009-2016 RStudio,Inc. Mozilla/5.0(Macintosh; Intel Mac OS X 10_12_1)AppleWebKit/602.2.14(KHTML,like Gecko)
我注意到rmarkdown文件的notebook功能。当生成图时,不再使用通常的“Plots窗口”,并且在代码块下方生成图。
下面的代码是错误的:
plot(seq(1,10,1))
abline(a=0,b=1)
字符串
错误显示在代码块下面:
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : plot.new has not been called yet
型
但是,当编织整个rmarkdown文件时,没有错误。
我想知道如何避免错误:
- 通过使用另一个代码
- 使用“Plots window”
- 或者其他方式
5条答案
按热度按时间sauutmhj1#
以下将工作
字符串
1cklez4t2#
在RStudio中,在Preferences -> R Markdown中有一个设置“Show output inline for all R Markdown documents”。要消 debugging 误,请确保未选中此设置。
8hhllhi23#
这样也行
字符串
dfty9e194#
在带有R内核的jupyter中,如果逐行运行代码,你会看到这个错误,就像XR SC提到的那样。
rqqzpn5f5#
这发生在我身上是因为我在我的图中添加了一个无效的参数。在我的例子中,我试图执行:
字符串
应该执行的:
型
注意,必须使用
ggtitle
,而不是title
。