ECON 290 · Economic Data and Computing
Reproducible Work: Files, Notes and Versions
Organize files, write down your steps and save versions so that you, or anyone else, can redo an analysis and get the same answer.
Key takeaways
- Reproducible work means another person, or you later, can repeat the steps and arrive at the same results.
- Keep raw data untouched, do every change in a script or a recorded step, and save outputs separately.
- Name files and folders so that their purpose and order are clear from the name alone.
- Write notes as you go: where the data came from, when you got it, and why you made each choice.
- Save versions deliberately, with a short message saying what changed and why.
Picture Leo, who spends three weekends on a project about rent and wages in his city. He finishes, hands in a chart, and feels good. Two months later his teacher asks: "Can you redo this with the newest data?" Leo opens his folder. It holds files named final.xlsx, final2.xlsx, final_REAL.xlsx and final_REAL_use_this_one.xlsx. He cannot remember which one made the chart. He cannot remember which cells he fixed by hand. He cannot remember whether he dropped two cities or three.
Leo's problem is not laziness. It is the normal result of working without a system. This lesson describes a simple one. The goal is called reproducibility: someone else (or you, next year) can follow your steps and get the same numbers.
Why this is more than neatness
Economics leans on numbers that people use to make decisions: budgets, forecasts, court cases, rules. If a result cannot be checked, others have to take it on trust. And mistakes happen to careful people. A shifted column, a formula that was copied one row too far, a number typed over a formula: these errors are common, and they are easiest to find when every step is written down.
There is a selfish reason too. You are the most likely person to need your own work again. The you of six months from now remembers nothing. Think of your notes as a letter to that person.
Another reason comes from the data itself. Sources change. As the lesson on revisions and vintages explains, agencies revise their numbers, so the same series downloaded in June and in December may differ. If you do not record when you downloaded it, you cannot tell why your results moved.
A folder that explains itself
Start with the layout of your project. A common, simple structure looks like this.
rent-and-wages/
README.txt (what this project is, and how to rerun it)
data-raw/ (original downloads, never edited)
data-clean/ (files created by your code from the raw ones)
code/ (scripts, numbered in the order to run)
output/ (charts and tables the code produces)
notes/ (log of choices and questions) The key rule: raw data is read-only. You never type into a file in data-raw. If the raw file has a mistake, you fix it in code, where the fix is visible. This is the same habit from the cleaning lesson: keep the original, change a copy.
Number your scripts in the order they should run: 01-download, 02-clean, 03-merge, 04-analyze, 05-charts. Anyone who opens the folder can see the story from top to bottom.
Each layer is built from the one below it. If you delete everything above raw data, the code can rebuild it all.
Naming things well
Good file names save arguments with your future self. A few rules help.
- Say what it is. rent-by-city-2026.csv beats data2.csv.
- Use dates in a sortable form. Write 2026-12-05, year first, so that files sort in time order. A name starting with 12-05-2026 sorts by month across years, which is a mess.
- Avoid spaces and odd symbols. Use dashes or underscores. Some programs choke on spaces.
- Do not use words like "final". Nothing is ever final. If versions matter, track them with a proper system, as below.
Inside a spreadsheet or a script, the same ideas apply. Label every column with a clear name and a unit, such as median_rent_usd. In code, use variable names that say what they hold.
Notes: a log of choices
Code shows what you did. It does not always show why. A short research log fills that gap. Each entry needs a date and a few plain sentences.
A good log might read like this.
2026-12-05 Downloaded rent data from the city's open data portal.
File: rent-by-city-2026.csv. Source page noted in README.
2026-12-05 Dropped 2 cities with no wage data (listed in 02-clean.py).
Dropping them lowers the sample from 40 to 38.
2026-12-06 Used the median rather than the mean, because two cities
have very high outliers. Notice what these entries record: what was done, where the data came from, a number that changes (40 to 38) and a reason. They are short, and each one will answer a question someone asks later.
Also write down questions and doubts. "Rent in city 17 looks too high; check the source" is a useful note. It is far better than finding the problem again by accident in front of a teacher.
Versions: a safety net for change
Even with tidy folders, you will change your work again and again. You need a way to try ideas without fear of ruining a version that worked, and a way to go back. That is called version control.
The crude way is to save copies with new names, which is how Leo ended up with final_REAL_use_this_one.xlsx. It fails because the names say nothing about what changed.
The professional way is a tool that records each saved state of your project, along with a short message. The most common tool is called Git. You do not need to master it in a day. The core ideas are simple.
- A snapshot (Git calls it a commit) records the state of all your files at one moment.
- Each snapshot carries a message: "Drop two cities with no wage data."
- You can look at the list of snapshots, compare any two, and return to an older one.
- A branch lets you try an experiment on a side path, and keep it or throw it away.
Tools like Git work best with plain text files such as scripts and CSV files. Spreadsheets are harder to compare, which is one more reason to put your cleaning steps in code.
Each snapshot has a message that says what changed, so any stage can be found and restored.
If Leo had kept a history like this, his teacher's question would take minutes: download the new file, rerun the scripts in order, compare.
A worked example: does the fix matter?
Suppose Leo finds the typo from the last snapshot. A city code was entered as 31 instead of 13, so wages for city 31 were matched to the wrong rent. Before the fix, his regression slope of rent on wages was 0.52. After the fix, it is 0.47.
What should he do? Here is the reproducible way.
- Fix the code in the cleaning script, not the output file.
- Rerun all the scripts in order to regenerate every output.
- Save a snapshot with the message "Fix city code 31 to 13; slope changes from 0.52 to 0.47."
- Add a line to the log, including the effect.
Compare that with the quick way: open the merged spreadsheet, type over one cell and hope no other file depends on it. Three weeks later the chart in the report says 0.52 and the table says 0.47, and nobody knows why.
The fix changed the slope by 0.52 − 0.47 = 0.05, or about 10 percent of the old value (0.05 ÷ 0.52 ≈ 0.096). That is a meaningful change, and because Leo wrote it down, he can tell his readers about it.
The clean-slate test
How do you know your project is reproducible? Test it. Copy the folder to a new place, delete everything in data-clean and output, and run the scripts in order from the top. If the same charts and tables come back, you pass. If a script fails because it needed a file that only existed on your machine, or a number differs, you have found a hidden step. Better to find it now than when a teacher, an editor or a boss asks.
Try the test early and often, not only at the end. A small project that rebuilds cleanly on day one tends to stay that way. A large project that has never been rebuilt usually hides a surprise or two.
You can also ask a friend to try it. If they can follow your README and reach your numbers without calling you, the project is in good shape.
Mistakes that break reproducibility
Editing raw data by hand. The edit leaves no trace. Do it in code.
Hard-coding numbers. If a script includes the number 38 because that was the count last time, it will be wrong when the data change. Let the code compute counts and totals.
Hidden steps. Clicking through a menu, running code out of order and keeping results in memory that no script creates all produce numbers no one can recreate. A good test: restart your tools, run the scripts from the top and see if you get the same outputs.
Forgetting the source. Write the website, the table name and the download date in your notes. The agencies described in the first lesson of this course often rename or rearrange their tables.
Sharing without context. A folder sent to a colleague with no README is a puzzle. Add a few lines saying what it is and how to run it.
Keeping secrets in the code. If you use a password or an access key to download data, do not paste it into a file you share. Keep it separate.
Finally, reproducible does not mean correct. A project can be perfectly repeatable and still wrong. But a repeatable project can be checked, and a checked project gets fixed. That is how good analysis improves.
Words to know
Reproducibility the ability of someone else, or you later, to repeat your steps and get the same results.
Raw data the original downloaded files, kept unedited.
Script a file of code that carries out analysis steps in order.
README a short note at the top of a project that says what it is and how to run it.
Research log dated notes recording what you did and why.
Version control a tool that records saved states of your files so you can compare or restore them.
Snapshot (commit) one recorded state of a project, with a message describing the change.
Check yourself
- Name three folders you would put in a reproducible project and say what goes in each.
- Why should you never type corrections into a file in the raw data folder?
- Which file name sorts better by date, 12-05-2026-rent.csv or 2026-12-05-rent.csv, and why?
- Leo's slope was 0.52 before a fix and 0.47 after. By how many percent of the old value did it fall? Round to the nearest whole percent.
- Why does it help to write the download date of a data series in your notes?
- Explain why a repeatable project can still be wrong, and why repeatability is useful anyway.
Show the answers
- For example: data-raw for untouched downloads, code for scripts in run order, output for charts and tables the code produces.
- Hand edits leave no record; fixes made in code can be seen, checked and rerun on new data.
- The second, 2026-12-05-rent.csv; with the year first, alphabetical order matches time order across years.
- The drop is 0.52 − 0.47 = 0.05; 0.05 ÷ 0.52 ≈ 0.096, or about 10 percent.
- Agencies revise series, so the same series downloaded at another time may differ; the date explains changes in your results.
- A repeatable project can repeat a mistake, but because every step is visible, others can find and fix the mistake.