* You are viewing the archive for the ‘R-project’ Category

A simple ggplot2 scatterplot revisited

Rick Wicklin contacted me with a helpful suggestion for improving the data presentation method outlined in my  previous post on using ggplot2 to visualize some data. In the previous post I had plotted up a highly correlated set of points, showing the correspondence between maximum daily body temperatures of model snails sitting with the foot touching the rock surface, or withdrawn into the shell.

The original figure.

Rick points out that with a bit of data manipulation, you can replot these … Continue Reading

A simple ggplot2 scatterplot

Here’s a bit of code used to produce one of the figures in my recent paper dealing with modeling rocky intertidal snail body temperatures. This was my first foray into ggplot2, and it only involved a few hours of head-scratching. The plot is a comparison of 10 years of  daily maximum body temperatures of a modeled littorine snail sitting on a rock with its foot out on the rock or withdrawn into the shell. The original data are here: dailymax_runs139_169.

The code below will open the data file, create the ggplot2 figure, and save the output … Continue Reading

Digitizing data from old plots using ‘digitize’

The June 2011 issue of The R Journal contains an article on the R package digitize (link to pdf) by Timothée Poisot. This might prove to be a handy tool if you occasionally find yourself needing to retrieve data points from figures in old articles for which you don’t have the raw data. There are a number of other stand-alone software tools to accomplish this same task, such as PlotDigitizer, DataThief, or TechDig (good luck finding that last one). These other programs all work, but I use them so rarely … Continue Reading

One minor detail for getting 64-bit R-2.13 running with Eclipse/StatET

Upgrading from R-2.12 to R-2.13 was fairly painless, except for one minor hiccup in trying to get the 64-bit version running on my installation of Eclipse + StatET under Windows 7. The setup instructions are almost entirely the same as I have outlined previously (R 2.12.0 and Eclipse with StatET installation). But when you go to set up a 64-bit environment in Eclipse using those instructions, you must make one change to the Environment Configuration. Shown below is what you get when you use the “Detect Default Properties/Settings” button to find all of your R-2.13 install locations. I chose … Continue Reading

Extracting sea surface temperatures from NOAA’s OISSTv2

Update, 2015-11-30 It appears that NOAA has gone through and upgraded all of the OISST files to the newer version of the NetCDF file format. As a result, the functions outlined in this post don’t work any longer. Instead, see the updated functions in my newer post, http://lukemiller.org/index.php/2014/11/extracting-noaa-sea-surface-temperatures-with-ncdf4/. The concepts are the same as described here, but the newer functions use the ncdf4 package to access the newer NetCDF file format.

Sea surface temperatures

NOAA’s Physical Sciences Division produces a global map of weekly averaged sea … Continue Reading

RStudio – another integrated development environment for R

RStudio for Windows, Linux, and Mac OS X

If you’re in the market for a very easy-to-setup integrated development environment for R, wander over to RStudio.org. They’ve just released a beta version of their freely-available front end for R that runs under Windows, Linux and Mac OS X (for R versions 2.11 and later).

If you’re not familiar with the idea of an integrated development environment, it’s simply an attempt to bring all of the tools needed for working with R into one uniform interface. Much like the basic … Continue Reading

Converting MATLAB and R date and time values

For some unknown reason, MATLAB codes its date/time values as the number of elapsed days starting from January 1 in the year 0000. R uses the equally arbitrary, but much more widespread POSIX/Unix epoch as a reference for time keeping, so that R’s POSIX time values are stored internally as the elapsed seconds since 00:00 January 1, 1970. Converting back and forth between the two values requires just a bit of doing.

Inside R, converting from the MATLAB ‘datenum‘ value into the R POSIXt standard is fairly straightforward: Subtract 719529 from your MATLAB datenum to get the … Continue Reading

Accessing NOAA tide data with R

Boston Harbor tides for December 2010, retrieved from NOAA CO-OPS server.

The National Oceanic and Atmospheric Administration makes the data from their many tide monitoring stations around the continent available for download. One way to access these data is through NOAA’s Center for Operational Oceanographic Products and Services (CO-OPS) website, which provides several access methods including an OPeNDAP server. The OPeNDAP server allows you to construct a fairly simple URL query to submit in a web browser, and it will return the requested data as ascii … Continue Reading

A lightweight object browser for R

The following post is based on information originally found here: http://r.789695.n4.nabble.com/Object-Browser-td2594912.html
If you use the basic R GUI and you can manage to remember what sorts of objects you have in the workspace more than 5 seconds after you enter them, you’ve got a better short term memory than I do. But if you constantly lose track of what variables, data frames, model objects and so forth you have in your R session, a separate “object browser” window can be a godsend.

Diehard R command line users just use the ls() command to list the objects in memory, and get a … Continue Reading

Book Review: Mixed Effects Models and Extensions in Ecology with R


Mixed Effects Models and Extensions in Ecology with R
Zuur, A.F., Ieno, E.N., Walker, N., Saveliev, A.A., Smith, G.M.
Springer, 2009

Somewhere along the line you probably realized that your undergraduate statistics classes didn’t quite cover the breadth of topics you’d end up needing for dealing with your data. The time constraints of a typical quarter or semester-long biostats class often leave you only scratching the surface of all of the issues you need to consider when analyzing a typical ecological data set. That’s … Continue Reading

Page 3 of 41234