Knitting bash code

Hello,
I apologize if it's a trivial question but I am a beginner with the R Markdown... I am using RStudio notebook and when I knit to HTML, I noticed that chunks written in bash are not in the notebook.nb.html. They are, however in the simple .html file.

I tried to use, in the chunk, {r, engine='bash'} but the bash source code and output are still not in the nb.html.
EDIT: I also tried the simple {bash}
How can I do to have the bash code and output in my nb.html?

Thanks a lot

Hi!

I know nothing about bash, but going through this, it seems to me that you should try {bash} instead of {r, engine='bash'}.

Thank you
I realize I was not clear, {bash} is the first thing I tried, before trying {r, engine='bash'}

Okay. I tried the following:

---
title: "R Notebook"
output: html_notebook
---
  
some text

```{r}
a <- runif(n = 10)
write.csv(x = a,
          file = "temp1.csv")
```

some text

```{r}
b <- rnorm(n = 10)
write.csv(x = b,
          file = "temp2.csv")
```

some text

```{bash}
cat temp1.csv temp2.csv > temp.csv
```

some text

```{r}
read.csv(file = "temp.csv")
```

some text

This gave me this .nb.html file:

Do you expect some other output?

As said earlier, I've no experience on bash, and hence I'll refrain myself from providing answers based on guesses. I'm sure other people on this community will help you in this problem. Meanwhile, please provide a REPRoducible EXample of your problem for them to help you.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.