Thursday, September 3, 2015

Trust Me, Coding in R is Just Like Rock Climbing

My goal for this post is to defend a statement that on the surface seems bonkers, but upon deeper inspection is 100% true:

Creating R code is just like rock climbing.

Rock climbing, according to, is “…the sport of climbing sheer rocky surfaces on the sides of mountains, often with the aid of special equipment.”  An activity that allows you to summit and safely descend the most beautiful places in the world!  Climbing gear and techniques are constantly evolving to create access to cliffs and peaks thought un-climbable a decade ago.  With know-how and practice, your rock climbing options are endless. 

R, according to, “…is a free software environment for statistical computing and graphics.”  It’s a single place for analyzing and plotting data!  R experts are constantly coming up with new packages to allow for cutting edge, sophisticated analyses and beautiful figures.  The options for analyses in R are endless. 

The elation of meeting a new challenge.  The dejection of running up against an insurmountable obstacle.  The problem solving component.  It’s all there in both coding and climbing. And I love both of them.  Nothing beats the satisfaction of successfully executing a beautiful, concise piece of code with no errors, except perhaps summiting a challenging climb whose difficulty matches my current skill.  Few things are worse than being stuck hanging in your harness on a challenging route and facing retreat, except the frustration of receiving the same inscrutable R code error 50 times. 

I just can't even....
R is amazing, rock climbing is amazing.  With a properly arranged dataset and seven lines of code I can create 150 separate graphs plotting water level over time in under two seconds.  Just like that.  Ctrl + Enter.  Boo yah.  Learning how to create a loop changed my life.  With the right climbing partner and a full rack of gear I’ve also stood on top of the Gossips formation in Arches, a tower that I’ve been intrigued with since I was 10 years old.  Seriously, I was on top of it. 

And the angel's started singing....
Rock climbing and R were both revelations to me.  Prior to rock climbing I spent hours walking to the top of mountains, frequently turning back from awesome adventures because I didn’t have the gear or knowledge to get to the summit; it was often tedious and disappointing.  Then some friends taught me how to climb stuff and now I can get directly to the top of desert towers with minimal wasted energy and maximum safety!  Before courses required me to use R for data analysis I spent months of my life entering, sorting and graphing data in Excel.  The analyses I could do were severely limited, usually requiring the creation of new datasheets for each analysis, and my efforts were constantly hampered by missing and misplaced data.  Now that I know how to use my rock climbing gear and R I have all the free time I could ever want!

You shall not pass!
Both climbing and coding require extensive experimentation and tinkering.  Even when the path forward seems obvious, like I’ve used that R package before or the line to the top of a climb is a single, clear crack in the rock, progress forward requires a lot of tinkering.  Most of the climbing tinkering is with regard to hand and foot placement, body position, and gear placement, while R tinkering is remembering variable names, a lot of spelling mistakes, and proper use of symbols.  In both cases it goes like this: nope, Nope, NOPE, YEAHHHH!  

Protecting 5 feet of a 100 foot climb

Adding a title to a graph
In between breakthroughs you may feel utterly useless, like a turd.  The best course of action, when the code just won’t work and you’ve reached a climbing plateau is to step away before you throw something.  It’s OK to go cry, just don’t break your computer or sell all your climbing gear because this pursuit is stupid.  That time away is critical to seeing the larger picture that tunnel vision blocks. Come back to the challenge with clear eyes and an open.  And maybe coffee. 

I don't even know where to go from here....
Powerful forearms are a must.  In climbing your forearm muscles control your grip strength, the power that keeps you hanging on the rock.  Creating and executing code requires finger dexterity, muscle endurance, and for me, the strength to highlight code with my right hand and type “Ctrl + Enter” with my left hand repeatedly.  It’s a work out. 

Progress in either pursuit can only be achieved by understanding the tools at your disposal, misusing those tools is dangerous.  The best and newest climbing gear in the world can’t replace know-how or protect crumbling, incompetent rock.  Similarly, using the latest and greatest R packages to generate figures won’t fix flaws in bad data or misunderstanding of statistical assumptions (this is an area I’m still working through myself). 

The best tools are often the simplest...
Finally, both hobbies have their own language that makes communication between practitioners easier.  Rock climbing lingo is a bit more bro-ish than R language, but delve too deeply into either and most people won’t know what you’re talking about.  A good rule for both climbing and coding is to utilize online forums (, without delving too much into the comments section; get the information you need to successfully execute your plan, leave helpful feedback, don’t call the other dirt bags names. 

Really the only differences I can see between climbing and coding are the importance of footwork and ropes in rock climbing.  What you do with your feet isn't all the critical when coding.

No comments:

Post a Comment