Articles by Marc in the box

R package “fishdynr”

February 1, 2015 | 0 Comments

The fishdynr package allows for the construction of some basic population dynamics models commonly used in fisheries science. Included are models of a single cohort, cohortSim, and a more complex iterative model that incorporates a stock-recruitment re... [Read more...]

Data point locator function

December 5, 2014 | 0 Comments

Here's a little function to select data points in an open graphical device (ptlocator()). The function does a scaling of the x and y axes in order to give them equal weighting and remove the influence of differing units or ranges. The function then cal... [Read more...]

Maximal Information Coefficient (Part II)

September 17, 2014 | 0 Comments

A while back, I wrote a post simply announcing a recent paper that described a new statistic called the "Maximal Information Coefficient" (MIC), which is able to describe the correlation between paired variables regardless of linear or nonlinear relationship. This turned out to be quite a popular post, and included ... [Read more...]

PCA / EOF for data with missing values – a comparison of accuracy

September 15, 2014 | 0 Comments

Not all Principal Component Analysis (PCA) (also called Empirical Orthogonal Function analysis, EOF) approaches are equal when it comes to dealing with a data field that contain missing values (i.e. "gappy"). The following post compares several methods by assessing the accuracy of the derived PCs to reconstruct the "true" ... [Read more...]

Rotated axis labels in R plots

August 5, 2014 | 0 Comments

It's somehow amazing to me that the option for slanted or rotated axes labels is not an option within the basic plot() or axis() functions in R.  The advantage is mainly in saving plot area space when long labels are needed (rather than as a means... [Read more...]

Flood fill a region of an active device in R

July 23, 2014 | 0 Comments

The following is a function to "flood fill" a region on the active plotting device. Once called, the user will be asked to click on the desired target region. The flood fill algorithm then searches neighbors in 4 directions of the target cell (down, le... [Read more...]

Decision making trees and machine learning resources for R

April 30, 2014 | 0 Comments

I have recently come across Ricky Ho's blog "Pragmatic Programming Techniques", which seems to be excellent resource for all sorts of aspects regarding data exploration and predictive modelling. The post "Six steps in data science" provides a nice overview to some of the topics covered in the blog. For some ... [Read more...]

Importing bathymetry and coastline data in R

January 25, 2014 | 0 Comments

After noticing some frustrating inaccuracies with the high-resolution world coastlines and national boundaries database found in worldHires from the package mapdata (based on CIA World Data Bank II data), I decided to look into other options. Although listed as "depreciated", the data found in NOAAs online "Coastline Extractor" is a ... [Read more...]

GMT standard color palettes

January 25, 2014 | 0 Comments

GMT (Generic Mapping Tools) (http://gmt.soest.hawaii.edu/) is a great mapping tool. I'm hoping to use it more in the future, but for the meantime I wanted to recreate some of the it's standard color palettes in R. Unfortunately, I couldn't find documen... [Read more...]

Data mountains and streams – stacked area plots in R

December 9, 2013 | 0 Comments

Below are two functions for producing stacked area plots. The first is the more typical approach where sequential series are stacked on top of another (function: plot.stacked), while the second approach is the more aesthetically-oriented version called...
[Read more...]

New version of image.scale function

December 5, 2013 | 0 Comments

Below is an updated version of the image.scale function. In the old version, one had to constantly use additional arguments to suppress axes and their labels. The new version contains the additional arguments axis.pos (1, 2, 3, or 4) for defining the s...
[Read more...]

Working with hdf files in R – Example: Pathfinder SST data

November 8, 2013 | 0 Comments

Following  a question that I posted on stackoverflow.com, I recieved the great advice to use the Bioconductor rhdf5 package to work with HDF5 files. The package is not located on CRAN, but can be sourced from the Bioconductor website: source("http://bioconductor.org/biocLite.R")biocLite("rhdf5") Created by ... [Read more...]

A first attempt at an individual-based model in R

October 29, 2013 | 0 Comments

I have been curious for a while as to how R might be used for the construction of an individually-based model (IBM), or agent-based model (ABM). In particular, what R objects lend themselves best to storing information on individuals, and allow for new... [Read more...]

A plea for less word clouds

April 25, 2013 | 0 Comments

Word cloud of DOMA hearing transcriptsI must admit, there is something appealing about the word cloud - that is, until you try to understand what it actually means...Word clouds are pervasive - even in the science world. I was somewhat spurred to wri... [Read more...]

My template for controlling publication quality figures

January 28, 2013 | 0 Comments

The following is a template that I usually start with when producing figures for publication. It allows me to control:The overall size of the figure (in inches) (WIDTH, HEIGHT)The layout of figure subplots (using the layout() function) (LO)The resoluti... [Read more...]

Choosing colors visually with ‘getcolors’

January 18, 2013 | 0 Comments

When plotting, I am constantly defaulting to the "main" colors in R - In other words, the colors that one can quickly call by number (1="black", 2="red", 3="green", 4="blue", ... etc.) . In my opinion, these colors do not lend themselves well to compelling graphics. I imagine this is the reason for ... [Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)