rmarkdown-绘制函数的中间结果

时间:2019-03-03 04:03:22

标签: r r-markdown knitr

我正在使用rmarkdown创建html文档。我有一个带有功能的简单代码块。函数内部是生成的两个图。

现在,当我运行代码时,两个图都显示在代码块下方。但是,我想在其plot()函数下面显示这些图。有谁知道如何实现这一目标? 谢谢菲利普

a <- 1:20
b <- 21:40

test_this <- function(a, b){

  dd <- cos(a)
  plot(dd) # => plot 1

  ee <- sin(b)
  plot(ee) # => plot 2

}

test_this(a,b)

我的html页面看起来像这样!!!!

enter image description here enter image description here enter image description here

但我希望这样:

a <- 1:20
b <- 21:40

test_this <- function(a, b){

  dd <- cos(a)
  plot(dd) # => plot 1

enter image description here

  ee <- sin(b)
  plot(ee) # => plot 2

enter image description here

test_this(a,b)

0 个答案:

没有答案
相关问题