【问题标题】:Knitr in sharelatex compiling R ~ How to remove output of a function?Sharelatex编译R中的Knitr〜如何删除函数的输出?
【发布时间】:2015-03-11 23:01:40
【问题描述】:

sharelatex中如何去除.Rtex文档中函数的输出?

我的 R 代码是什么样子的

## ---- myfunction1
dat = read.table(data.txt,header=T)
lm1 = lm(Response~.,data=dat)
drop1(lm1,test="F")

我的 Rtex 代码是什么样子的

<<echo=FALSE, cache=FALSE>>=
read_chunk("myfunction.R")
@

<<myfunction>>

@

这将打印代码和输出。

如果我设置 echo=FALSE,则不会打印代码,但会输出

@

我也试过 cache=FALSE/TRUE, hide=FALSE/TRUE 没有成功

【问题讨论】:

  • 您希望函数评估,但静默?

标签: r latex knitr


【解决方案1】:

没有承诺,但你尝试过吗:

1) results = "hide",显示代码并移除输出

2) include = FALSE,评估代码但同时删除代码和输出

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-11
    • 2014-08-15
    • 2014-01-01
    • 2015-07-29
    • 2019-03-20
    • 2021-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多