Blog Archives

Example of unit testing R code with testthat

Here’s a little example of using Hadley Wickham’s testthat package for unit testing R code. You can read more about testthat here.

Tagged with: ,
Posted in Software development

My Channel 9 interview from Brisbane

Here’s an interview I did with Microsoft Channel 9 right after my talk in Brisbane. You can find the interview in multiple audio and video formats on Channel 9.

Tagged with:
Posted in Software development

Basics of Sweave and Pweave

Sweave is a tool for embedding R code in a LaTeX file. Pweave is an analogous tool for Python. By putting your code in your document rather than the results of running your code somewhere else, results are automatically recomputed

Tagged with: , , ,
Posted in Python

R without Hadley Wickham

Tim Hopper asked on Twitter today: #rstats programming without @hadleywickham’s libraries is like ________ without _________. Some of the replies were: (skydiving, a parachute) (gouging your own eyes out, NULL) (dentistry, anesthesia) (shaving, a razor) (internet shopping, credit card) Clearly

Tagged with: ,
Posted in Graphics

Beta inequalities in R

Someone asked me yesterday for R code to compute the probability P(X > Y + δ) where X and Y are independent beta random variables. I’m posting the solution here in case it benefits anyone else. For an example of

Tagged with: ,
Posted in Statistics

Installing R and Rcpp

Almost exactly a year ago, I wrote about my frustration calling C++ from R. Maybe this will become an annual event because I’m back at it. This time my experience was more pleasant. I was able to install Rcpp on

Tagged with:
Posted in Software development

Machine Learning for Hackers

Drew Conway and John Myles White have a new book out, Machine Learning for Hackers. As the name implies, the emphasis is on exploration rather than mathematical theory. Lots of code, no equations. If you’re looking for a hands-on introduction

Tagged with: , ,
Posted in Computing

Comparing R to smoking

Francois Pinard comparing the R programming language to smoking: Using R is a bit akin to smoking. The beginning is difficult, one may get headaches and even gag the first few times. But in the long run, it becomes pleasurable

Tagged with:
Posted in Statistics

Running Python and R inside Emacs

Emacs org-mode lets you manage blocks of source code inside a text file. You can execute these blocks and have the output display in your text file. Or you could export the file, say to HTML or PDF, and show

Tagged with: , , , ,
Posted in Python

R in Action

No Starch Press sent me a copy of The Art of R Programming last Fall and I wrote a review of it here. Then a couple weeks ago, Manning sent me a copy of R in Action. Here I’ll give

Tagged with: , ,
Posted in Statistics

The Art of R Programming

Here are my first impressions of The Art of R Programming. I haven’t had time to read it thoroughly, and I doubt I will any time soon. Rather than sitting on it, I wanted to get something out quickly. I

Tagged with: ,
Posted in Software development

RLangTip changing hands

I’ve decided to hand my Twitter account RLangTip over to the folks at Revolution Analytics starting next week. I thought it would be better to give the account to someone who is more enthusiastic about R than I am, and

Tagged with: ,
Posted in Uncategorized

Calling C++ from R

This post relates my experience with calling C++ from R by writing an R module from scratch and by the inline module.

Tagged with: ,
Posted in Software development

New Twitter account: RLangTip

I’m starting a new daily tip Twitter account: RLangTip. This account will have one regularly scheduled tip per day, Monday through Friday, on the R language and related topics. I’ll also throw in a few unscheduled tweets now and then.

Tagged with: ,
Posted in Uncategorized

Regular expressions in R

Notes on using regular expressions in R. R uses POSIX regular expression syntax by default but you can ask it to use Perl’s flavor of regular expressions. Related links: Regular expressions in C++, Mathematica, Python, R, PowerShell R for programmers

Tagged with: ,
Posted in Uncategorized