假设我有两个源文件,第一个名为
当我运行example1.r时,图形被绘制出来了。但是当我运行example2.r时,却没有绘制出来。这里的解决方案是什么?
(在example2.r中的qplot是ggplot2的函数)
example1.r
,第二个名为example2.r
(如下所示)。
example1.r
plot(1:10,1:10)
example2.r
qplot(1:10,1:10)
当我运行example1.r时,图形被绘制出来了。但是当我运行example2.r时,却没有绘制出来。这里的解决方案是什么?
(在example2.r中的qplot是ggplot2的函数)
invisible(p)
,因为print(p)
返回的是p
。 - Richie Cottonprint(p)
实际上返回的是invisible(p)
- 这正是我想要的(如果它可见,从命令行使用它将会产生两次绘图)。已相应地编辑了代码。 - cbeleites unhappy with SXqplot()
是否能与ggplot2
的分层函数很好地配合使用?2)对于其他生成输出的ggplot2
函数,是否需要类似的重新定义 -ggplot()
? - Aleksandr Blekh.R
文件,而是使用.Rnw
文件。我几乎完全改用knitr
而不是Sweave
,并且knitr
默认模拟R命令行的print
行为,因此对我来说,答案在很大程度上已经过时了。 - cbeleites unhappy with SXggplot()
而不是qplot()
,你可以并且需要应用相同的策略。 - cbeleites unhappy with SX