Hack Grand Forks – 311

I’ve been thinking about this for a while, and finally took a few evenings to do it. I built a Mastodon bot that toots each Grand Forks 311 request: https://botsin.space/@hackgfk_311. It also crossposts at https://twitter.com/hackgfk_311.

The code can be found at https://github.com/mattbk/hack-grand-forks. Yes, I built it in R.

Mastodon toots from @hackgfk_311@botsin.space.

Why “hack”? In the sense that this is information that should be more available to people, and I’m making it more available without going to a separate location. Perhaps something good can come of it.

sum() with raster::aggregate() in R

If you try to use sum() directly in raster::aggregate() and have NA values, you’ll get NA as a result. You need to build a tiny function and pass the rm.na=T command to sum(). More succintly:

# Dissolve duplicate geometries and sum OOIP
 fm <- raster::aggregate(fm.raw,
                         sums=list(list(function(x) sum(x,na.rm=T),


Comparing two lists with R

No, not list() lists.

a <- data.frame(name=old$NAME)
a$status <- "old"
b <- data.frame(name=allfields[allfields$StateAbbre=="ND",]$name)
b$status <- "new"


Make two data frames, one for each list, create a column identifying each one (new or old), then join on the common column (name).


Example output from comparing to lists in R using a merge().
Example output from comparing to lists in R using a merge().

See also: http://stackoverflow.com/questions/17598134/compare-two-lists-in-r/17599048#17599048