# Monthly Archives: February 2015

## drat Tutorial: Publishing a package

February 22, 2015
By

Introduction The drat package was released earlier this month, and described in a first blog post. I received some helpful feedback about what works and what doesn't. For example, Jenny Bryan pointed out that I was not making a clear enough distinction between the role of using drat to publish code, and using drat to receive/install code. Very fair point,...

## k-means clustering and Voronoi sets

February 22, 2015
By
$k$

In the context of -means, we want to partition the space of our observations into  classes. each observation belongs to the cluster with the nearest mean. Here “nearest” is in the sense of some norm, usually the (Euclidean) norm. Consider the case where we have 2 classes. The means being respectively the 2 black dots. If we partition based...

## Priors on odds and probability of success

February 22, 2015
By

In Bayesian Approaches to Clinical Trials and Health-Care Evaluation (David J. Spiegelhalter, Keith R. Abrams, Jonathan P. Myles) they mention that an non informative prior should be uniform over the range of interest. They combine this with the d...

## Visualizing Hubway Trips in Boston

February 21, 2015
By

Most Popular Hubway Stations (in order): Post Office Sq. – located in the heart of the financial district. Charles St. & Cambridge – the first Hubway stop after crossing from Cambridge over Longfellow Bridge. Tremont St & West – East side of the Boston Common South Station Cross St. & Hannover – entrance to North End combing from financial … Continue reading Visualizing...

## Export R output to a file

February 21, 2015
By

Sometimes it is useful to export the output of a long-running R command. For example, you might want to run a time consuming regression just before leaving work on Friday night, but would like to get the output saved inside your Dropbox folder to take a look at the results before going back to work on Monday. This can be...

## Continuous Integration for R packages

February 21, 2015
By

What is git? Git is a version control system, and the best I have worked with for that matter. 15 years ago, I was happy when my company decided to migrate from RCS to SVN. Branching became simple, and many daily problems just disappeared. So I shuned other source control versioning systems for a long The post Continuous Integration...

## RcppAPT 0.0.1

February 21, 2015
By

Over the last few days I put together a new package RcppAPT which interfaces the C++ library behind the awesome apt, apt-get, apt-cache, ... commands and their GUI-based brethren. The package currently implements two functions which permit search for package information via a regular expression, as well as a (vectorised) package name-based check. More to come, and contributions would be...

## using the httr package to retrieve data from apis in R

February 20, 2015
By

For a project I’m working on, I needed to access residential electricity rates and associated coordinate information (lat/long) for locations in the US. After a little searching, I found that data.gov offers the rate information in two forms: a static list of approximate rates by region and an API, which returns annual average utility rates (\$/kWH) for residential, commercial,...

## HOW TO: Package vignettes in plain LaTeX

February 20, 2015
By

Ever wanted to include a plain-LaTeX vignette in your package and have it compiled into a PDF? The R.rsp package provides a four-line solution for this. But, first, what's R.rsp? R.rsp is an R package that implements a compiler for the RSP markup language. RSP can be used to embed dynamic R code in any text-based...

## Making Maps in R with Ryan Peek and Michele Tobias

February 20, 2015
By

Today, Ryan Peek and Michele Tobias gave an introduction to making maps in R. Here’s the webcast: (Pardon the little scuffle at the beginning and as we switched computers halfway through. Still getting the hang of hangouts.) Resources: Download all of Ryan’s code and HTML files here. See Michele’s slides on Slideshare here. Code for Michele’s example maps in her GitHub. repository.