Distance to a lake

How far are you from a lake? Living in Wisconsin, I wanted to know. There’s a lot of lakes in Wisconsin, but it was hard to visualize their distribution. Step 1) Download the high-resolution National Hydrography …

R Color (Colour) Table

I love the seemingly endless color options in R. However, I also waste a lot of time googling ‘r colors’. I finally decided I should just print off a color table for my office wall, …

Extracting polygon areas in R

Suppose I have a shapefile (lakes.shp) which consists of 5 polygons (Figure 1a). library(raster) lakes = shapefile(’lakes.shp’) plot(lakes, col=’dodgerblue’,main=’a) lakes’,lty=0) The shapefile is stored as a SpatialPolygonsDataFrame. The data underlying these polygons can be viewed …

readr 0.2

If your life as an ecologist is spent loading/writing .csv files in R, you should be using readr. Why? Well it’s a Hadley Wickham package for one. But really, it’s defaults make sense! read_csv: strings …

Oh god, umlauts!

Sweden has more lake data than most countries have lakes. However, they also have a 29 letter alphabet including ‘å’, ‘ä’ and ‘ö’. This results in lake names like Fräcksjön and Östra Helgtjärnen. Goal Combine …