I gave a talk at Monday night’s Winston-Salem R Users Group that covered a lot of the base R package, and also showed a brief demo of how to use packrat when packages are necessary, and so is sharing code across multiple team members and/or environments.
The idea came from a comment at a previous meeting about the dangers of trying to maintain common versions of code within and across teams, not just to avoid surprising errors, but also to ensure reproducibility.
So my recommended approach was:
Learn as much as you can about the details of the base package. It’s a huge package, and a lot of common needs can be handled simply and effectively.
When you need a package (and there are certainly useful and necessary packages), use a system like packrat to keep dependencies systematically managed.
Most of the content wouldn’t be a surprise to daily R users, but I did throw in some things that either 1) surprised me when I first learned them, or 2) increased my productivity so much that I think everyone should know them.
So even though I’ll likely never be using SHA-1 in the future (and more importantly, would never use my own implementation in a real-world project), I thought I’d sit down with the spec and see if I could implement it in Python, which I haven’t been using as much as I want to lately.
Thankfully NIST also provides a short example case to check against.
After a recent spec change, I needed to start looping around a block of code that was previously using a single environment to store objects. The easiest approach was to create an initial base environment to use at the start of each iteration of the loop, and then create a copy of that environment that would be specific to the loop iteration.
But I got a surprise!
All of the result environments looked like the last iteration.
First, let’s look at how this works when you start with a base list, make a copy, and modify the copy:
I downloaded a shapefile of North American topographical contours a while ago, and never spent much time with it until recently, when I noticed there are some really fascinating subsets of the United States.
For reference, the file comes from this page, and contains contours at 100-meter resolution. That’s actually not very detailed if you’re looking at a county or a city, but for an area this large with a pretty wide range in elevation, it’s plenty to get the big idea.
Speaking of big idea, here’s the full layer, with the color scale ranging from blue at the low end to red at the highest elevations:
Okay, big deal – flat in the east and south, mountains in the west, right? Stay with me…
I don’t do a ton of pure web development, but I like when I get to work on a project where I can explore a new tool, and this presentation allowed me to summarize the pros and cons that I found while working on the social media analysis dashboard that I’ve written about as a case study.