djmurphy420/ggplot2-transition-guide — comment on commit ae050eb3133ce559adc1488edb96231fb2b08081
File: ggplot2-0.9.0-BW.Rnw line 1353
By djmurphy420:

Hi Yihui,

I don't do conditional evaluation much with R code in documents, so thanks for the idea. Sometimes I forget I can actually do this :)

As for your last comment, neither Hadley nor Baptiste ever suggested moving away from \tableofcontents; that was my doing as an experiment. In fact, Baptiste is trying to help me through a private thread of e-mails to produce a nicely automated table with xelatex. I think what Hadley wanted was a more attractive TOC layout than the default, so now I'm looking into a couple of LaTeX packages for ideas to try to keep things as automated as possible. The responsibility for the current TOC is mine alone.

Question about the code chunk example: in the hist-color chunk, shouldn't bw_version be the opposite? How would you denote that? !bw_version? It would also make sense to put

<<>>=
bw_version = TRUE # change it to FALSE for colored version
col_version = FALSE
@

and then flip them when going from B/W to color. That way the rest of your code should work virtually unchanged (changing bw_version to col_version in the code chunk header, of course).

Regards,
Dennis

________________________________
From: Yihui Xie
To: Dennis Murphy
Sent: Monday, February 6, 2012 10:02 AM
Subject: Re: [ggplot2-transition-guide] Updated .Rnw files, both color and B/W friendly (ae050eb)

You can play with the feature of conditional evaluation to put two chunks in the same document, but evaluate one this time, and another next time, e.g.

```r
<<>>=
bw_version = TRUE # change it to FALSE for colored version
@
```r
<>=
qplot(...) + scale_gray()
@
<>=
qplot(...)
@
```

It is unbelievable that experts like Hadley and Baptiste do not use `\tableofcontents` and they prefer hand-made table of contents! No, no, no...

---
Reply to this email directly or view it on GitHub:
https://github.com/djmurphy420/ggplot2-transition-guide/commit/ae050eb3133ce559adc1488edb96231fb2b08081#commitcomment-937473