Search code examples
rrstudioknitrr-markdownrnotebook

Why does R notebook display truncated lines in "html_notebook" output?


I have a R notebook named "test.Rmd" with the following content:

---
title: "R Notebook"
output: html_notebook
---
```{sh}
faToTwoBit dmel-all-chromosome-r6.04.fasta dmel-all-chromosome-r6.04.2bit
```

Then rstudio will create "test.nb.html" automatically. However, the code chunks are wrongly displayed in the html:

enter image description here

It only displayed bit, instead of the entire line (faToTwoBit dmel-all-chromosome-r6.04.fasta dmel-all-chromosome-r6.04.2bit). Is there something wrong with my .Rmd?


Solution

  • I'm not familiar with the shell command you are running, however, it seems that the language engine is getting confused with the way to display it.

    Given that the form is meant to be faToTwoBit in.fa [in2.fa in3.fa ...] out.2bit, I recommend explicitly stating the engine.

    ---
    title: "R Notebook"
    output: html_notebook
    ---
    
    ```{test1, engine="sh"}
    faToTwoBit dmel-all-chromosome-r6.04.fasta dmel-all-chromosome-r6.04.2bit
    ```
    

    enter image description here

    You could also lodge an issue on github, where they may be able to provide a more permanent solution.