1

I have some simple rmarkdown code that generates some HTML. When I run this code I get a bunch of output in my console that looks like this below..

|......... | 14% ordinary text without R code

|................... | 29% label: unnamed-chunk-1 (with options) List of 2 $ results: chr "asis" $ echo : logi FALSE

|............................ | 43% ordinary text without R code

|..................................... | 57% label: unnamed-chunk-2 (with options) List of 2 $ results: chr "asis" $ echo : logi FALSE

|.............................................. | 71% ordinary text without R code

|........................................................ | 86% label: unnamed-chunk-3 (with options) List of 2 $ results: chr "asis" $ echo : logi FALSE

|.................................................................| 100% inline R code fragments

Here is the code that generates this output ..

---
output:
  html_document:
    theme: null
    highlight: null
    css: src/bootstrap.css
---
<link href="src/style.css" rel="stylesheet">

<div id="page">

<h3 id="title-style"> Identification of Respiratory Tract Pathogens by Unbiased Sequencing </h3>

  <p id="inline">Patient: </p>
  <p id="inline">Date of Birth: </p>
  <p id="inline">Gender: </p>
  <p id="inline">Physician: </p>
  <p id="inline">Client: </p>
  <p id="inline">Client Address: </p>

<div id="logo2-lp">
  ![logo](src/logo.png)
</div>

<div id="spacer"></div>

<h3 id="header-style-vir"> Detected Pathogens </h3>
<table id="table-style-vir">
<tr>
 <td>
```{r results='asis', echo=FALSE}
  library(xtable)
  print(xtable(pathogens_table2[c(1:nrow(pathogens_table2)),c(4:10)]),type='html',include.rownames=FALSE)
```
 </td>
</tr>
</table>

<h3 id="header-style-vir"> Evidence for Detection </h3>

<div id="font-style-text">
<font size=1 >
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
</font>
</div>


</div>

I’ve tried adding options to the embeded R code such as warning=FALSE, message=FALSE, error=FALSE, results=‘HIDE’, echo=FALSE or a combination of all of these with no success. I’ve also tried this code when calling the markdown file..

 suppressMessages(rmarkdown::render(“markdown_file.Rmd", output_file = “output.html”))

That doesn’t give me the results I’m expecting either. How to I completely remove output to the console when running rmarkdown files?

webDevleoper101
  • 69
  • 3
  • 14

1 Answers1

2

In addition to Roman's solution using render() options, you can also modify the opts_knit settings in a chunk near the top of the file, e.g.:

```{r}
opts_knit$set(progress=FALSE, verbose=FALSE)
```

This way the progress will be hidden even if you are not directly calling render() yourself.

Keith Hughitt
  • 4,860
  • 5
  • 49
  • 54