My principal page for full coding will be on GitHub, but here you can start.
In my master's, I mainly used two languages: R and STATA. Now, in my PhD, I am using more STATA.
Some tips before you start:
Be patient, it's a new language you are learning
Practice and repeat the simple command
Organise well the data, files and more, call it simply the database you want to work with: for example, "df" means" data frame"
Start with a simple analysis, and then you will master it
This code is exact. So, step by step, line by line, is better
You can always ask for help in the system, and from many developers
In the beginning, you are not an expert. Therefore, try to use the manual command by clicking
Later, you can make it only by typing the code, keep it simple
🧠 Next Steps in Coding with R and STATA
Based on my experience during my Master’s and PhD studies, here are some practical tips to level up your skills in R and STATA.
Understand the logic of your analysis before writing the code. Try to write down the steps in your notebook first.
Create a clear project folder structure: include folders like raw_data, clean_data, scripts, results, and docs.
Always comment your code. Future you (or a teammate) will thank you for it.
Use version control or at least save backups of each stage of your code (e.g., "do_file_v1", "v2", etc.).
Keep a master “do file” or “script” that links and runs all other scripts to reproduce your full workflow from start to finish.
Learn to write your own functions for repetitive tasks. This improves efficiency and clarity.
Study other researchers’ code from published papers. Try to replicate small sections to understand their structure.
Don’t just clean your data — document how you did it. This improves transparency and reproducibility.
Use packages or add-ons intentionally. Focus on the ones that match your needs and learn them well.
Incorporate visualization tools like ggplot2 in R or graphr in STATA to improve the quality of your graphs and figures.
Automate your summary tables and final outputs using code — this is essential for professional reports and papers.
If using STATA: master loops like foreach and forvalues, along with if conditions to streamline tasks.
If using R: practice chaining your analysis using the pipe operator (%>%) for cleaner code.
For bigger projects: keep a coding log or diary with daily progress, key decisions, and bugs encountered.
Most importantly, treat coding as a learning journey. Save your scripts with dates and notes to track your progress and keep improving.
R Code recommendations
Install R (check well step by step to install it)
Use this webpage ("here")
Organise well in three main files:
(1) data (raw), (2) do file (your code), (3) output(your production). This is a better start
Run the packages you need to use.
// run the library you need, for example:
library(tidyverse)
library(generics)
library(estimatr)
// upload your data (go to import data and choose the format)
Download the files you want to work with
Import the files first, and use the commands by clicking
// check your data
head(data1)
summary(data1)
Hist(data1$variable1)