The document below runs the sql and shows the results. I don't want any output to show up, either by not running the chunk, or by hiding the output.
Is there a way to do this?
---
output: html_document
---
## Hide SQL Output
First, set up a temporary database:
```{r}
library(RSQLite)
conn <- dbConnect(SQLite(), tempfile())
df <- data.frame(value = runif(1))
dbWriteTable(conn, "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}
SELECT * FROM TestTable;
```
I get this output:
I found a workaround. If I use the mysql
engine instead of the sql
engine, then at least eval = FALSE
works:
```{mysql eval=FALSE}
SELECT * FROM TestTable;
```
will display the code with syntax highlighting but not execute anything.
I don't know if results="hide"
is also supported, because I don't have mysql installed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With