PTFM-2681 R API wrappers

If someone (Phil?) could look over the build process, that'd be great.  It seems to work on both Linux and Mac OS X.