Two Books

I received two books via Amazon this summer that I truly devoured. The first is called Beautiful Data. Each chapter in this book comprises a separate essay written about data. The topics range from data collection to data storage to data analysis–and all were fascinating. For example, Aaron Koblin with Valdean Klump contributed a chapter entitled Building Radiohead’s House of Cards. 
This is the story of how the Grammy-nominated music video for Radiohead's "House of Cards” was created entirely with data. Before you read the chapter, you should watch the video. The definitive source for the video is the project’s Google Code page: http://code.google.com/radiohead. On that site, you’ll also find several other resources, including sam- ples of the data we used to build the video, a Flash application that lets you view the data in 3-D, some code you can use to create your own visualizations, and a making-of video. Definitely check it out.
There were several cool things about this book, not the least of which was the royalties for the book were being donated to Creative Commons and the Sunlight Foundation.

The second book that really excited me this summer was Nathan Yau's Visualize This. Nathan is the creator of Flowing Data, one of the best blogs on data that exists. In his book, he explains how to create some super-sweet (it's a technical term) visualizations of data. I can't say enough nice things about this book. And....it's aesthetically pleasing to look at.


With This Kind of Taste It Should Have Been Called iTunZ

What kind of music do you listen to? This is a question I hear a lot. Well, not really anymore, but it sounds more impressive if I start with something that sounds cool. The answer to this question is conditional on the moment in life that it is asked (at least to me). If you asked when I was a toddler, it would have been Sesame Street and Lawrence Welk; at 14...Weird Al Yankovic. While I still hold a soft spot for those performers ("Monster in the Mirror" might be one of the greatest songs ever recorded) they aren't currently at the top of my iTunes playlists. Anyway, that was sort of a long-winded introduction to a blog post that identifies some of the music that currently plays in my head.

24hr Rhythm (DJ Topcat)
This is near the top of my most recently played songs. Mashing up the sweet stylings of Eazy E. (24 Hours to Live) with the illustrious Man in Black (Get Rhythm) makes for a gem. I also really groove on Folsom Prison Ganstaz. Topcat has also combined Jay-Z/Led Zepplin and Rhianna/Alice in Chains. Check out his stuff at http://sites.google.com/site/djtopcat/

The All-Girl, All-Gospel Quartet (The Statler Brothers)
This is a beautiful song. The Statler Brothers might be the best storytellers of all-time. (Note the play on "all"). The harmonies alone put this song on my list.

Oh Sherrie (Steve Perry)
You should've been gone
Knowing how I made you feel
And I should've been gone
After all your words of steel
Need I say more?

I Remember You (Queens of Dogtown)
Seriously. What is cooler than a Skid Row cover you ask? A Skid Row cover by Lenny Kravitz's daughter's (Zoƫ Kravitz) band. Even better, they were the band that Hank Moody's daughter forms in Californication.

Too Country (Bill Anderson, Brad Paisley & Chuck Cannon)
Whisperin' Bill Anderson is a legend. Brad Paisley married Kimberly Williams (Father of the Bride). Plus he is a pretty darned good singer. His duet with Alison Krauss, Whiskey Lullaby, may be one of the most haunting, depressing songs out there. Chuck Cannon is better known for his songwriting, but on this tune he whales.

Right Here Waiting (Richard Marx)
I bought the Stories to Tell album on a lark earlier this summer. What a great buy! Richard Marx acoustic. All of his classics. Try not singing along. It's impossible. Hazard, Angelia, Hold on to the Nights, Should've Known Better, Endless Summer Nights,...man, Richard Marx is 'da bomb.


I (Heart) TV

When I was younger, I spent a lot of time watching movies. I watched, on average, about 5-10 movies per week throughout my twenties. But lately, I have had a hard time digesting movies of any kind. I get antsy and I also think that they have really lost a lot of appeal to me. On the other hand, I currently (heart) television. There are so many great shows on now. Better acting...better writing...better everything. (Bonus: If you fall in love with a show there are often multiple seasons!) So, inspired by lists everywhere, here is my list of favorite shows (in no particular order other than how they come to mind):
  • Big Bang Theory (Do I know these people? I am these people.)
  • Sons of Anarchy (Awesome!)
  • Californication (Awesome Squared!)
  • Dexter (Love the show , love the books.)
  • Game of Thrones (I can't wait for Season 2)
  • Breaking Bad (The last season wasn't as good, but I will withhold judgment...for now)
  • The League (It makes me laugh)
  • Revenge (I do (heart) Kevin Williamson.)
  • Suits (I can't pass up a good lawyer show or movie.)
  • Vampire Diaries (Teen drama = me watching)
  • Rookie Blue (nothing to really say here)
  • Detroit 1-8-7 (again....no reason)
  • Justified (totally sweet....gotta love the hat)
  • The Walking Dead (The rumor is Season 2 isn't as good...)
  • Chuck (geez I watch a lot of TV)

Here is a list of shows I watch, but either haven't come to (heart) or no longer (heart):
  • House (Getting old, but I still like House as a character.)
  • True Blood (This show jumped the shark after Season 1)
  • PanAm (I (heart) Christina Ricci, but that is about it)
  • Rescue Me (It got repetitive and should have ended a season or two before it did.)
  • Gossip Girl (First season was great....then...???)
  • Lie to Me (ho-hum)
  • Hung (the characters are not growing on me...no pun intended)
  • Weeds (i'm bored)
  • Entourage (see above)
  • Mad Men (this show is som much better on mute)
And finally,  a list of shows that I have watched and (heart) but are no longer with us:
  • Dawson's Creek (see comment for Revenge)
  • Friday Night Lights (an underrated show)
  • The Shield (got better with every season)
  • The Wire (see above)
  • The Booth at the End (only on Hulu)
  • Outlaw (Still love a good lawyer show)
  • My So-Called Life (Claire Danes + Jared Leto = pretty. The quintessential 90's show)
  • Portlandia (Life in Portland....so apt)
  • Wonderfalls (so quirky)
  • Durham County (Dark...gritty)
  • Freaks and Geeks (my junior high life)
  • October Road (The TV version of "Beautiful Girls")
  • Life (revenge...prison...great)
I'm sure I'm missing some. Some that I watched but really don't make the list are Hidden Palms (Kevin Williamson), Sex and the City (after the second movie it doesn't deserve mention),  V (the original series), Flight of the Conchords (their music is the best), MI-5 (BBC = napping), and many more...


Post-Processing of R Graphs in Inkscape

In creating beautiful graphs for publication or public consumption, R sets the bar pretty high. There are somethings, however, that are not as easy to do with R. For example, a person might want to change the fonts, or move observation labels. While this can be accomplished in R, it is much easier to post-process graphs using third-party software such as Adobe Illustrator.

Inkscape is an  open-source graphics editor that has many of the same features as Adobe Illustrator. Inkscape uses the W3C standard Scalable Vector Graphics (SVG) file format. This format makes it easy to edit and manipulate text separate from the image as a whole. R also has support for saving plots in the SVG format.

The RSvgDevice package includes the function devSVG() to write graphics output to a SVG file. This function operates similarly to the pdf() or jpeg() functions. The dev.off() function is used to complete writing to the SVG file. An example is given below in which the studentized residuals from a regression of Zagat ratings on average price of a meal are plotted against the average cost of the meal. (You can get the data and codebook (MplsZagat) from the EPsy 8262 website here.)

# Fit linear model
model.zagat <- lm(Rating ~ Cost, data = zagat)
# Open SVG device
devSVG("/Users/zief0002/Desktop/restaurants.svg", height = 5, 
width = 6)
par(mfrow = c(1,1))
plot(x = zagat$Cost, y = rstandard(model.zagat),  
	ylab="Studentized Residuals")
abline(h = 0)
abline(h = -2, lty = "dotted")
abline(h = 2, lty = "dotted")
text(x = zagat$Cost, y = rstandard(model.zagat), labels = zagat$Name, pos = 4)
# Turn off SVG device

The plot on the right is what is produced after running the R commands. This plot can then be post-processed using Inkscape. In this example, I have changed the font to Georgia, and rearranged many pf the text labels so that they don't overlap. I also increased the size of the font on the axes labels. You can see the difference between the plot that defaults from R and that same plot that has been post-processed in Inkscape (below).

In the example, the function devSVG() was used to write to the SVG file. The function svg() also works to write to a SVG file, but the text labels are not treated as text in this file. When I examined the XML code, it seems that this function was writing the text nodes as paths rather than text nodes.

One thing to note is that since the SVG file writes as XML, this means that the XML in the file needs to be well formed in order for Inkscape or a browser to open the file properly. For example, I had many ampersands (&) in the labels I used in the scatterplot because they existed in the data frame. These have to either be changed to "and" or the escaped unicode character of "&#038" can be used. (It is probably easier to just replce them with the word "and", then replace the ampersand in the label in Inkscape.)

SVG allows for the creation of interactive graphs as well. Deb Nolan and Duncan Temple-Lang have written the package SVGAnnotation (available on omegahat) that allows for features such as:
  • add tooltips,
  • add hyperlinks,
  • animate the plots,
  • implement simple linking,
  • add CSS information to an SVG document  
For example, rather than having the names of the restaurants on the plot (Sorry Mr. Tufte...I know it's plot clutter...sigh), the tooltips would allow the name of the restaurant to be displayed when hovering your mouse over the observation. You can read a great paper by Deb and Duncan about these features here.