R and Python (RPy2): Rank-revealing QR Decomposition

I used to use R all the time until I got into Python, NumPy, and SciPy.

In general, however, R has much more sophisticated packages for statistics (I don’t think there’s too much argument here).  Unfortunately, R, in my opinion, is a cumbersome language for string manipulations or more general programming (though it is fairly capable).

You can get the best of both worlds with RPy.

I recently wanted to calculate the rank of a matrix via a QR decomposition as an alternative to computing the SVD.  I haven’t yet seen code to do this in numpy.  R, on the other hand, computes this automatically in its ‘qr’ function.  To get this running in my numpy/scipy code, I didn’t even have to worry much about matrix format conversions between the languages.   After a couple of ‘imports’ and within 5 minutes I calculated the rank in Python via the R code:

rqr = robjects.r[‘qr’]
print rqr(R)[1][0]

Wikipedia on your coffee table!

So I recently thought I had this awesome idea that you could take the “featured articles” in Wikipedia and turn them into a book or volume of books that people could buy and just keep one on their coffee table.  You may agree with me that there’s a certain serendipity associated with traditional binded books or journals that is hard to replicate when browsing the web on a desktop, laptop or iPad-like device.

I was not too surprised, a little disappointed, and pretty excited to find out that this has been done.  The most comical creation of a Wikipedia book has to go to Rob Matthews for actually attempting to bind all the featured articles.  On a more serious front, I was happy to see that PediaPress, wiki-to-print publishing service, is partnered with the Wikimedia foundation to do exactly this.  It’s integrated quite well with Wikipedia so you can click on the articles you want to include in your own book or you can select books that have already been compiled by PediaPress.

As an alternative to purchasing a book, you can also generate a PDF that you can print at your own leisure.  My only gripe when immediately trying this is that scalable content Latex equations are embedded in the PDFs as if they are images.  It still looks decent, though, and is pretty cool!