Google, The Brew’s On Me

[This article was first published on awaiting assimilation, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


While drinking these fine liquids may up your trip count to the john, they can also make your R reports better. Not because they allow you to reach your Ballmer Peak… but because each of these elixers is the direct result of brewing.

Okay, I’m reaching. Brew is my own clever name for my very own clever R package that allows the lucky user to use common template processing techniques to generate textual reports. It’s similar to Sweave, but brew can do something that Sweave cannot. It can utilize control flow statements to loop through repeated text and code chunks or conditionally include them with if/else statements. I could go into detail here. Instead I’ll point to a most excellent resource that does a far better job.

Brew was written on a whim, stemming from a conversation I had with my colleague Charles Dupont (Hmisc maintainer). We were discussing the very issue that Sweave was limited because of lack of control-flow. I bet him it would be very easy to come up with a function that could work just like eRuby (he’s a big fan of ruby) or PHP. And a few days later I had it working! All it took was a little hubris, impatience, and laziness! (Look at the code to see how lazy. I dare you.)

Which brings us to Google…

I don’t know if there are others of you like me out there. I sometimes stare at the non-existent windows in my drab, colorless office and wonder what the heck I’m doing. Reading blogs, tweeting the interwebs, tinkering rather than working, planning my marathon debut (years away), thinking about software, writing code bits, all the while making sure that the code I do write won’t rot and never get put to use. I wonder if anyone uses my software. Then all of a sudden (more like at the beginning of this year), I get an email from someone at Google. (!) He says there’s an issue with your Brew package. Nothing big, just an extra file in the tarball that shouldn’t be there. I email a thanks. I update Brew. Then a few months later I’m curious about what they’re up to, why they use brew. He says a few analysts (smart analysts- uber smart analysts- analysts that passed the rigorous interview process- the same interview process I didn’t pass five years ago) are using Brew. I ask why they use it. He puts me in touch with one of the uber smart analysts that passed the rigorous interview process (it was them that asked me to apply! I wasn’t looking for a job). I start an email conversation with him that leads to the following (paraphrased, a little):

UberSmartAnalyst: So and So told me you were curious about what we use the brew package for at google. The typical use case of brew is to dynamically generate LaTeX documents, which are converted to pdf or html. Thanks for making this package available, it is very useful and convenient.

Me: Excellent! Using brew in place of Sweave was one of my main motivations for writing the package in the first place!

UberSmartAnalyst: I actually started with Sweave, and it was incredibly frustrating 🙂 Being able to use R loops and conditionals to repeat/omit blocks of text is so convenient.

Well, I guess I have to thank my good friend Stuart Smalley for his encouraging words: I am good enough, I am smart enough, and dog-gone it, Google likes me.

Your welcome, Google.

To leave a comment for the author, please follow the link and comment on their blog: awaiting assimilation. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)