Project-oriented workflow; setwd(), rm(list = ls()) and computer fires

I followed a little bit of that Twitter discussion and was somewhat surprised by the pushback the idea received (though, as you point out, the wording may have had something to do with that).

I just want to reinforce one bit:

In my personal experience, not getting into the habit of saving intermediate steps to a file was the biggest impediment to completely internalizing the idea that "source is real" ((c) @jennybryan?). It makes you very dependent on your workspace, as a section of code that takes even two minutes to run seems highly wasteful to re-run when you are in the middle of an analysis. And then, inevitably, you make an irreversible change while to an object that takes some time to generate while testing syntax, and so you try to include the steps that the produced the change in your source file, but you won't run it because that would mean wasting multiple minutes of your life.

The point being, definitely save your intermediate steps! If the object itself is a reasonably small and simple data frame (no nested columns/strange attributes/etc), it can even make sense to save it out to a csv instead of a rds. Being able to "show your work" with intermediate files can help when sending the analysis to a non-R-using client.

3 Likes