Capturing contents within Curly Brackets

OK, just a quickie here. I’m working with a colleague on a manuscript using LaTeX.  The citation formatting for the journal we are looking at uses the numerical citations but bibtex will number the citations by the order in which the \bibitem  values they occur in the bibliography section.  So, it would be great to get them to be in the order in which they occur in the text.

So, our old friend (and sometimes enemy) grep comes to the rescue.  Here is a quick one-liner that allows you to search the text for all the \cite{}  entries and return only the contents within the curly brackets.

Once all the editing is done and we’ve finished on the main body of the text, we can reorder the bibliography section and the numbers will be incremental.

Sometimes I forget how awesome and powerful the unix underpinnings are.

Intalling Shiny Server on Ubuntu 14 LTS

Intalling Shiny Server on Ubuntu 14 LTS

OK, so I just ‘found‘ shiny and it has a lot of cool stuff to it.  OK, I’ve known about it for a long time but have just had the opportunity to sit down and work it out and see how it can fit into the presentation and learning I’m trying to develop in my Applied Population Genetics online textbook.  Here is a brief overview of how I set up the shiny server on my Ubuntu box that is hosting the book (so I can embed more interactivity in the display).

Read more

ERAC Spring 2016 Presentation

ERAC Spring 2016 Presentation

Environmental Research Advisory Committee meeting
Virginia Transportation Research Council

The spring meeting of the VDOT ERAC is this week and Bonnie and I will be going to provide some feedback on what we’ve been doing on the project the last two months (it is pretty early yet, we are just getting going).  Should be fun, lots of cool other projects being presented.  See the slides below the fold.

Read more

New Package – dlab

I just uploaded a new plugin for RStudio called dlab.  I’ll be migrating over all the little helper functions I use to this as a general require() on startup.  What it has now is an AddIn that allows you to select text and have it wrapped in the r-code markup.  I’m moving stuff between ePub and Markdown and it was needed.

You can install it as:

then look at the AddIns menu for wrapCode.

STRUCTURE on OSX

STRUCTURE on OSX

The program STRUCTURE is an ubiquitous feature of many population genetic studies these days—if it is appropriate is another question. Today, while covering model based clustering in population genetics, we ran into a problem where STRUCTURE was unable to run and the OS said it was Corrupted and should be thrown away.  Jump below for our fix, it really is an easy one.

Read more

Buffers & Convex Hulls

Buffers & Convex Hulls

An analysis common to modern population genetics is that of finding ecological distances between objects on a landscape.  The estimation of pairwise distance derived from spatial data is a computationally intensive thing, one that if you are not careful will bring your laptop to its knees!  One way to mitigate this data problem is to use a minimal amount raster area so that the estimation of the underlying distance graph can be done on a smaller set of points.  This example provides a simple solution using convex hulls.  Jump below for the complete example.

Read more

Cropping Rasters

Cropping Rasters

It is often the case that the raster we are working with is not the exact size of the area from which our data are collected. It is a much easier situation if the raster is larger than the area than if you need to stitch together two raster Tiles to get all your data onto one extent. In my doctoral thesis work, the area of the southern Ozark mountains that my sites were in was not only straddling a boundary between existing rasters, it was also at the boundary of two UTM zones! What a pain.

Read more

Raster Plotting

Raster Plotting

A raster is essentially an image, whose pixel size correspond to a particular spatial extent and the data contained within each pixel represents a particular feature on the landscape. Common rasters are DEM’s (measuring elevation), rainfall, temperature, buildings, etc. In R, it is common to think of rasters as matrices whose values measure some feature on the landscape. In this section, we will examine how to acquire, load, manipulate, and extract data from raster objects.

Read more