1

I do not have code for this question, and hope I can explain it. While I am editing my rmarkdown file, I would like to knit it to see what it looks like until this point. I only want to see what it looks like until this point without knitting the whole file every time. I am wonder if we can insert a mark or something, so the rest of the file will be ignored or taken as plain text.

I have tried to add ````. It changed the color of the rest of text to orange, but still ran the inline code in it.

```{r setup,echo=FALSE}
run this
```
Chapter 1 with inline code `r code` and text, 
edit this `r code`, knit until this point ignoring the rest:  
Chapter 2.... ... Chapter 10 with a lot of inline code. 
Zhiqiang Wang
  • 6,206
  • 2
  • 13
  • 27

1 Answers1

1

In Rmarkdown, you have a code chunck as

```{r [options]}
your code
```

For options you have eval,echo,messages, etc., but the beauty is that they are passed as render works though it. So you should be able to do something akin to:

```{r setup,echo=FALSE}
run this
```

I am doing code stuff! *Yeah*

```{r load_data}
More code
evalfromhere=FALSE
```

```{r step2b,eval=evalfromhere}
Doesn't work yet
```

```{r name2,eval=evalfromhere}
Also not yet
```

Once you are satisfied, set evalfromhere to TRUE, or remove the chunk options as you go along.

Rmarkdown is based on knitr, so read these documentations: https://yihui.name/knitr/options/

MrGumble
  • 5,631
  • 1
  • 18
  • 33
  • 1
    Thank you, @MrGumble, for answering my qustion. I have revised my question. I am trying to find a quick way to tell knitr not to knit the rest of the text file with inline code as well as several chunks. – Zhiqiang Wang Sep 03 '19 at 07:32