Category: R-project
-
Brief mention in Map-making on a budget
Some of the R code I have previously posted here for working with NOAA’s optimal interpolated sea surface temperature (OISST) datasets made its way into a recent piece in a Nature news and commentary piece on open-source map-making tools by Jeffrey Perkel. The article details the expansion of open-source tools for visualizing spatial data that…
-
Processing Rmarkdown documents with Eclipse and StatET
Processing R markdown (Rmd) documents with Eclipse/StatET external tools requires a different setup than processing ‘regular’ knitr documents (Rnw). I was having problems getting the whole rmarkdown -> pandoc workflow working on Eclipse, but the following fix seems to have resolved it, and I can generate Word or HTML documents from a single .Rmd file…
-
R plotmath functions combined with variable values
Getting certain special symbols into R plots, combined with values that are currently stored in variables, has been an ongoing headache of mine. In particular, plotmath symbols such as the plus-minus sign (±), for which the plotmath command is %+-%, had always caused problems due to my inability to parse the R help documentation. For…
-
rtide: a R package for predicting tide heights (US locations only currently)
Joe Thorley at Poisson Consulting has released a new R package, rtide, (on which I am listed as a co-author) that provides the ability to predict future (and past) tide heights for 637 different tide stations in the United States and associated territories. The underlying data, consisting of tide harmonic constituents, are collected and released…
-
Using knitr and R to make instructor/student handout versions
I teach some of my lab sections using R, and so I need to create lab handouts that include nicely formatted R commands and R output as an example for the students. These handouts will also include exercises where the students will be writing their own R code, or interpreting the results, or generating figures.…
-
Basic text string functions in R
To get the length of a text string (i.e. the number of characters in the string): [code lang=”R” gutter=”false”] nchar()[/code] Using length() would just give you the length of the vector containing the string, which will be 1 if the string is just a single string. To get the position of a regular expression match(es)…
-
A plot of co-authorships in my little corner of science
Here’s a mostly useless visualization of the collection of journal articles that sits in my reference database in Endnote. I deal mostly in marine biology, physiology, biomechanics, and climate change papers, with a few molecular/genetics papers thrown in here and there. The database has 3325 entries, 2 of which have ambiguous publication years and…
-
Extracting NOAA sea surface temperatures with ncdf4
I’ve written previously about some example R scripts I created to extract sea surface temperature data from NOAA’s Optimum Interpolated Sea Surface Temperature products. If you want daily global sea surface temperatures on a 0.25×0.25° grid, they gather those into 1-year files available at http://www.esrl.noaa.gov/psd/data/gridded/data.noaa.oisst.v2.highres.html. If you want weekly average SST values on a 1×1°…
-
NOAA OISST v2 High Resolution daily sea surface temperatures with R
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, https://lukemiller.org/index.php/2014/11/extracting-noaa-sea-surface-temperatures-with-ncdf4/. The concepts are the same as described…
-
Part 2: Make your R figures legible in Powerpoint/Keynote presentations
In the previous post, I outlined some tips for increasing the size of figure labels for figures that are meant to be displayed on a projector. The previous post used the base R plot() function, but the procedure when plotting with ggplot2 is different and usually quite a bit simpler than the stock R plotting…