You can make use of child documents.
```{r main}
x = TRUE # or FALSE
```
Then
```{r test, child = if (x == TRUE) 'child-a.Rmd' else 'child-b.Rmd'}
```
Regards,
Yihui
--
Yihui Xie <
xiey...@gmail.com>
Phone:
515-294-2465 Web:
http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA