An Alternative R Wrapper for PHREEQC Geochemical Modelling

by on May 1, 2017

Recently I was introduced to PHREEQC, which is a program that models chemical interactions between rocks and water (among many, many other things). It is an open-source project by the USGS, and has a number of powerful features, including modeling equilibrium concentrations of elements according to various input parameters (e.g. temperature, pH). My task for […]

Major ggspatial updates

by on March 28, 2017

I took the day to update ggspatial an old R project that was never published to CRAN. The idea is to create ggplot layer() calls from sp Spatial* objects using a consistent interface. Last year I wrote a blog post about how that might work, and while the usage hasn’t changed much, the implementation is […]

Line-by-line, row-by-row…

by on March 27, 2017

The NatChem database from Environment Canada contains the best long-term atmospheric monitoring data that exists for Canada, similar to the National Atmospheric Deposition Program (NADP) in the US. Unlike the NADP, the distribution format associated with NatChem data is a hideous export format that looks like it was used by SAS at one point. readLines(“natchem_sample.CSV”, […]

The Mineralogical Paragram

by on March 19, 2017

Matt Hall from Agile Geoscience recently wrote a post on the problem of finding the shortest possible pangram (sentence containing all letters in the alphabet) using only mineral names. The post goes into the details on the set cover problem, of which assembling a pangram from a list of minerals is one example. Matt’s best […]

Programmer-friendly names come to rclimateca!

by on February 27, 2017

The most frustrating thing about working with the previous version of the rclimteca package is the column headers given by Environment Canada. In R it is possible to refer to these columns using the backticks or the double bracket, but to save on typing I introduced a predictable column renaming function that removes the hard-to-type […]

apply() yourself in R

by on November 14, 2016

A few months ago I wrote what I thought was a quite useful post on list comprehensions in R, which, after working with numerous datasets since, I have realized is almost useless. In the post, I suggested a few ways to go about generating vectors of data using non-vectorized functions. Packages such as foreach, plyr, […]

Holes in ggplot polygons

by on July 13, 2016

As part of my efforts to construct an R package connecting ggplot and Spatial objects, I came across an issue with ggplot involving holes in polygons. According to the collective knowledge of StackOverflow, it’s possible to make this happen by putting the coordinates in the correct clockwise/counterclockwise order, extending geom_polygon() somehow, or other really complicated […]

Spatial data in ggplot2

by on July 12, 2016

I recently figured out how to use the ggplot2 framework to plot raster data, which led me to write a package extending ggplot2 for more convenient spatial data geometries. Ever wanted a geom_spatial() for those SpatialPolygonsDataFrames and RasterBricks you’ve got kicking around? Well…maybe you did or didn’t, but the ggspatial package is now here for […]

WP Facebook Like Send & Open Graph Meta powered by TutsKid.com.