General
- Switch from Stata to R and Python
- Make sure you know all of them
- If you cannot learn all of them, make sure you are expert in one first
- Predoc employers often emphasize this, and that they believe an expert in one language can quickly pick up other languages
- Once you do 1 and 2, prioritize R and Python
- Why? Aside from all their common advantages, LLMs are much better in R an Python due to the large amount of tidy code online in Python and R vs Stata. If LLMs like ChatGPT and Github copilot
- JMSLab Template
- Editorconfig
- Gentzkow and Shapiro (2014)
- For complex tasks:
- conceptualize the structure of your ideal dataset, on which you can run analyses, then work toward that structure
- write a roadmap with a numbered sequence of steps, then code with each numbered section step by step
R
-
tidyverse grammar / style > data.table grammar for readability - Conditional on this, use
data.table whenever for speed
-
Air for formatting -
renv for reproducibility
Python
-
pixi / uv instead of conda / pip for ease of managing virtual environments - I had the “privilege” to use conda-mamba for two years. It wasted countless of my hours and I recommend it to no one. Even after I switched to
uv, and manually (yes, miniforge does not have an uninstaller (nor any instructions on Windows!)) uninstalling it, it still managed to waste more hours of mine by making my OS raise uninformative errors. This is the definition of an all-intrusive software.
-
ty for static typechecking -
ruff for fast linting / formatting -
polar / pyjanitor instead of pandas for speed and readability - method chaining instead of square bracket operations for readability
-
plotnine instead of matplotlib for readable grammar-of-graphics plotting
Communication
- Describe data by row, colum, and unique level
- Each row identifies a …
- Key columns include …
- Data is unique at … level