Blog Archives

Passing columns of a dataframe to a function without quotes

May 6, 2013
By
Passing columns of a dataframe to a function without quotes

I love the syntax of calls to lm and ggplot, wherein the dataframe is specified as a variable and specific columns are referenced as though they were separate variables. While developing some of my functions, I’d wanted to introduce something similar. I often find that I have a single large dataframe and want to execute

Read more »

Callback functions for GUI widgets

March 18, 2013
By
Callback functions for GUI widgets

Of all the things I dislike about R, one of the biggest is the fact that you can declare a function within the list of arguments to another function. I’ve gotten over it for very minor operations needed by things like lapply, but it can drive me bonkers elsewhere. One such instance is writing an

Read more »

Clustering Loss Development Factors

February 15, 2013
By
Clustering Loss Development Factors

  Anytime I get a new hammer, I waste no time in trying to find something to bash with it. Prior to last year, I wouldn’t have known what a cluster was, other than the first half of a slang term used to describe a poor decision-making process. Now I’ve seen it in action a

Read more »

Building a package in RStudio is actually very easy

January 30, 2013
By
Building a package in RStudio is actually very easy

So, you’ve written some code and you use it routinely. Now you’ve written some code and you’d like to use version control to ensure that development continues in a robust fashion. You do that and you use Github or something so that not only are changes tracked, but the general public receives the benefit of

Read more »

Object Orientation in R – Notes from a novice

January 25, 2013
By
Object Orientation in R – Notes from a novice

Having posted some code to Git a few days ago and having been wholly dissatisfied with it, I began to do what I often do with code I don’t like. I started re-writing it bigger and weirder and more philosophically pure. Part of this search for Platonic code lead me to explore object oriented programming

Read more »

Loss reserving has a new, silly name

January 18, 2013
By
Loss reserving has a new, silly name

I started using Git some time ago, but mostly for local work files. Today, I finally sync’ed up a repository for loss reserving analysis. It may be found here: https://github.com/PirateGrunt/MRMR MRMR stands for Multivariate Regression Model for Reserves. When pronounced “Mister Mister” it also sounds like a thankfully forgotten American soft pop band from the

Read more »

You can’t spell loss reserving without R

January 2, 2013
By
You can’t spell loss reserving without R

Last year, I spent a morning trying to return to first principles when modeling loss reserves. (Brief aside to non-actuaries: a loss reserve is the financial provision set aside to pay for claims which have either not yet settled, or have not yet been reported. If that doesn’t sound fascinating, this will likely be a

Read more »

NFL Code on Github

January 2, 2013
By
NFL Code on Github

I’ve made some revisions and simplifications to the code to compile NFL data. It’s now all out on Github for anyone to play with in advance of the Superbowl. In the meantime, here’s a lovely picture comparing every team’s offense- as measured by total offensive yards- against their defenders. Note the anemic Chicago offense. https://github.com/PirateGrunt/NFL

Read more »

Nested loops with mapply

December 31, 2012
By
Nested loops with mapply

So as I sink deeper into the second level of R enlightenment, one thing troubled me. “lapply” is fine for looping over a single vector of elements, but it doesn’t do a nested loop structure. These tend to be pretty ubiquitous for me. I’m forever doing the same thing to a set of two or three

Read more »

Querying, parsimony and golden hammers

December 20, 2012
By
Querying, parsimony and golden hammers

I love it when things are easy. I love it so much that I’ll spend a great deal of time and effort to keep things simple. At the same time, though, I think there’s some value in expending effort in pursuit of something. If you want to understand a thing, you have to spend time

Read more »