As a data science software consultant for the Stanford libraries, I often hear people complain that R is slow. I wrote this blog post to demonstrate that R code can oftentimes be re-written to be much, much faster.

I wrote this as part of taking Hadley Wickham’s Readings in Applied Data Science course at Stanford in the spring of 2018.


As data science skills become increasingly important, the teaching of data science becomes increasingly valuable. In the context of data science, I think of teaching not as the traditional process of talking at a whiteboard or grading worksheets, but instead as the process of creating environments and designing experiences that lead to measurable learning for students.

As a matter of definition, I am interested in developing in students the ability to extract value out of data (which I’ll…

I noticed in basketball why I’m bad. I noticed why I was bad my sophomore year and got cut. I finally figured it out. I play differently in different situations. When I used to play 3 on 3 in my driveway with my friends I was confident. Every time I got the ball the first thing I would do is take a dribble towards the hoop. It was an assertive move. …

The way we teach data science is broken. Actually, even that statement strikes me as generous. In most cases, I’m not sure we even try.

I don’t mean anything too grandiose by the term data science. In this context, I use ‘data science’ to mean the ability to take a large amount of data (more than excel could open comfortably), create graphs, generate summaries, and draw some sort of meaningful conclusion about what the data has to say.

It seems to me that people fall into roughly two cases when it comes to learning data science. One, people who should…

There’s this old trick I remember hearing about that if you really want a girl to fall in love with you, you should do exciting things like take her on roller coasters or take her hiking to really get her heart pumping. The logic as I remember it isn’t that she’ll fall in love with such an adventurous guy, it’s that you’ll get her heart racing and she’ll misinterpret it as feelings for you.

How crazy is that? Let’s run that back:

1) Take a girl on a roller coaster
2) Her heart starts racing (because of the roller coaster)
3) She…

I’ve been thinking about getting started lately. I read in Jo Boaler’s Mathematical Mindsets about the “I just have to give them information first before they can do anything” problem that teachers often respond with when other people tell them they should stop talking and get their kids doing stuff.

I remember feeling that way a lot. Like, you want my kids to master exponential functions? There isn’t an activity I can give them where they’ll just self discover these properties. …

Some things in life are more valuable to know than others. A few of the things that seem most valuable to know are about keeping healthy relationships, finances, and how to really truly learn something on your own.

I realized today that this is why I’ve never really bothered to learn to cook. If I don’t know how to manage my finances, I might end up broke, but if I don’t know how to cook, I just have to eat spinach out of a bag.

Principle 1 — Get to deep work: Spend as much time as possible in deep work. Deep work is focusing without distraction on a cognitively demanding task.

The three types of work:

  1. Deep work — Maximize time here
  2. Shallow task hacking — Like emailing or logistical planning. Batch this and do it in blocked off chunks.
  3. Multi-tasking — Do as little as possible


  1. Blog post: Some Notes on Deep Working
  2. Blog post: Knowledge Workers are Bad at Working (and Here’s What to Do About it)
  3. Book excerpt: Excerpt from Deep Work
  4. Book: Deep Work by Cal Newport
  5. Essay: Good and Bad Procrastination by Paul Graham
  6. Podcast: Cal Newport interview (30 mins)

Principle 2 — Use systems: Use systems to handle tasks and free your brain to solve problems and generate ideas.

Key ideas:

  1. Hold tasks in a system instead of your brain
  2. Always have the next…

It seems to me that life is a lot about estimating the importance of different things. The better the estimates I make, the better life I will live.

The thing with estimating is that your estimate is almost certainly wrong. That sounds like a really bad thing, and it can be, but here’s the saving grace: Our estimates are wrong in systematic, predictable ways.

This got me thinking while I was making mac and cheese today. When you’re systematically wrong, you can greatly improve your estimates by making an adjustment. For example, if I know I will underestimate the importance…

I was talking to my friend on the phone the other day about moving to a new city and making friends. I was telling her how I’ve been in Austin now a handful of months and I know I’m leaving soon, so it kind of feels like I should just leave now. I don’t have any friends I’m super close with and making friends takes a lot of work, you know, so it just sort of seems like I’ll make it happen in California.

We really dug into this. It was a beautiful conversation. We talked about how there are…

Ben Stenhaug

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store