Reputation: 330
I have a few plotting chunks in an .Rmd file.
I would like to have a chunk that calls only theses specific chunks. Example follows:
### Plot A
```{r 1 - PlotA}
X <- 1
y <- 5
```
### Plot B
```{r 2 - PlotB}
print(X + y)
```
### Troubleshoot
```{r 3 - TB}
X <- 8 # a modification of 'X'
# Want to call chunk "Plot B"
```
Upvotes: 2
Views: 509
Reputation: 50668
I think this is more of a question about code design than about R markdown.
How about the following: Create a function complex_function
and run complex_function
with different arguments to troubleshoot.
```{r define_function}
complex_function <- function(x, y) print(x + y)
```
```{r default_values}
x <- 1
y <- 5
```
```{r analysis}
complex_function(x, y)
```
### Troubleshoot
```{r trouble-shoot}
complex_function(8, y)
```
Upvotes: 1