Announcing jsonfeedr, a new R package

June 01, 2017
I have not yet spent the time to figure out how to generate a JSON feed in Hugo yet. But I have built an R package to play with JSON feeds. It’s called jsonfeedr, and it’s silly simple. Maybe I’ll extend this in the future. I hope people will submit PRs to expand it. For now, I was inspired by all the talk about why JSON feed even exists. Working with JSON is fun and easy.
Read More…

Functions as Arguments in R

May 29, 2017
Sometimes, silly small things about code I write just delight me. There are lots of ways to time things in R. 1 Tools like microbenchmark are great for profiling code, but what I do all the time is log how long database queries that are scheduled to run each night are taking. It is really easy to use calls to Sys.time and difftime when working interactively, but I didn’t want to pepper all of my code with the same log statements all over the place.
Read More…

Making Sense of dplyr 0.6

May 18, 2017
Non-standard evaluation is one of R’s best features, and also one of it’s most perplexing. Recently I have been making good use of wrapr::let to allow me to write reusable functions without a lot of assumptions about my data. For example, let’s say I always want to group_by schools when adding up dollars spent, but that sometimes my data calls what is conceptually a school schools, school, location, cost_center, Loc.
Read More…

Foreign Keys and assertr

April 02, 2017
I have been fascinated with assertive programming in R since this from 2015 1. Tony Fischetti wrote a great blog post to announce assertr 2.0’s release on CRAN that really clarified the package’s design. UseRs often do crazy things that no sane developer in another language would do. Today I decided to build a way to check foreign key constraints in R to help me learn the assertr package.
Read More…

Labeling Data with purrr

March 03, 2017
Here’s a fun common task. I have a data set that has a bunch of codes like: Name Abbr Code Alabama AL 01 Alaska AK 02 Arizona AZ 04 Arkansas AR 05 California CA 06 Colorado CO 08 Connecticut CT 09 Delaware DE 10 All of your data is labeled with the code value.
Read More…