Category Archives: R

Nest thermostat data access using R

UPDATE 12/03/13: Since Nest Labs’ move to an official API, the code below no longer works. Still, a good example of a webservice connection… Gets “energy_latest” (10 days of usage) data from Nest Labs: Advertisements

Posted in data access, R | Tagged

Getting names of objects in an R workspace by type

To identify data frames in a workspace, and iterate over them by name, use Filter() with a few other functions: Here, objects() lists objects in the workspace, class() identifies their classes, and sapply() looks at each object in turn, returning … Continue reading

Posted in data munging, R | Tagged

Map of the United States including Alaska and Hawaii with R

Alaska and Hawaii represented in a typical state-level choropleth map — i.e. below the Southwestern border states. Turns-out it’s not that straightforward to do. After some tinkering… …the result: Seems as though the AK and HI portions of the layout … Continue reading

Posted in mapping, packages, R | Tagged , , , ,

From a long to a wide R data frame, with array values

From a “long” data frame with columns containing the names of measured properties and corresponding vectors of values, attempting to make a “wide” data frame with a column for each measured property. Appears as though the cast() function of the reshape … Continue reading

Posted in data munging, R | Tagged , , , , ,

Storing numeric vectors (or arrays) in fields of an R data frame

To store variable-length data vectors and corresponding single-value data in separate fields of the same row of an R data frame, add a new modeless column then populate it: R recognizes that the vector’s class is numeric, but it is necessary … Continue reading

Posted in data munging, R | Tagged , , , ,

rgdal on Mac OS X: reprise

After successful installation of rgdal on a Mac, trying again on an older MacBook Pro running OS X 10.5 (Leopard). Upgraded to the latest R (2.13.1), and followed all of my previous steps. But on “R CMD INSTALL…” got an … Continue reading

Posted in os x, packages, R

rgdal on Mac OS X

This was a bit of a headache to get right. Here’s what worked on OS X 10.6.7 (Snow Leopard, i386 architecture, R version 2.12.2): 1) Download the “GDAL Complete” framework from and install. 2) Open R, and on the startup panel in … Continue reading

Posted in os x, packages, R | Tagged , ,