下面的文档运行sql并显示结果。我不希望任何输出出现,要么不运行块,要么隐藏输出。
有办法这样做吗?
---
output: html_document
---
## Hide SQL Output
First, set up a temporary database:
```{r}图书馆(RSQLite)
conn <- dbConnect(SQLite(),tempfile())
df <- data.frame(value = runif(1))
dbWriteTable(康涅狄格州,"TestTable",df)
Now show a query, but try not to run it, and try
to hide the output. Neither works: it runs, and
displays the table.
```{sql connection = conn,results="hide",eval=FALSE}从TestTable中选择*;
我得到了这个输出:

发布于 2016-11-06 11:57:01
我找到了解决办法。如果我使用mysql引擎而不是sql引擎,那么至少eval = FALSE可以工作:
```{mysql eval=FALSE}从TestTable中选择*;
将显示语法突出显示的代码,但不会执行任何操作。
我不知道是否也支持results="hide",因为我没有安装mysql。
https://stackoverflow.com/questions/40444521
复制相似问题