A bit of fun with R
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
R isn't just about serious things like model inference and prediction intervals and big analytics. Sometimes, R lets its hair down and just does weird and wonderful things because … well just because. For example, with a package from Paulo Sonego, it can display your favourite XKCD cartoon:
> install.packages("RXKCD", repos="http://R-Forge.R-project.org",type="source") > searchXKCD("support") num title 1 8 Red spiders 2 278 Black Hat Support 3 384 The Drake Equation 4 480 Spore 5 554 Not Enough Work 6 619 Supported Features 7 644 Surgery 8 745 Dyslexics 9 806 Tech Support 10 818 Illness 11 838 Incident 12 627 Tech Support Cheat Sheet > getXKCD(806)
(Hmm, maybe that's not so frivolous after all. The searchXKCD function was perfect for finding one of my favourite XKCD comics, and the source code for getXKCD is a great example of doing JSON queries from R and also of using raster images.)
Here's another example of a bit of fun with R. Neil Gunther of Performance Dynamics shows us how to create a winking pink elephant with R:
(Hmm, maybe that isn't so frivolous after all. The code that generates that image is actually a really good example of doing complex arithmetic in R — the elephant is based on a Fourier transform generated by just 5 parameters — and also provides a good example of using the animation package to create animated GIFs in R.)
What other fun things do you use R for? Let us know in the comments.
R-bloggers.com 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.