ImpactMojo
Browse Premium
Back to Labs
Interactive Course · Live code

R & Python for Development

A South Asia 101 — learn to code from absolute zero, with real R and Python running live in your browser. No installation, no account, works on a modest laptop.

Module 1 of 7 · Pilot

Your first line of code

Two languages run almost everything in development-sector data work: R (loved by statisticians and evaluators) and Python (loved by data scientists and engineers). You do not have to choose — this course teaches both, side by side, so you can read either one and pick what your team uses.

Everything here runs inside this page. Click Run and the code executes in your browser — nothing is installed and nothing is sent to a server.

First run downloads the engine. The very first time you Run R or Python, your browser fetches the language runtime once (R ≈ 7 MB, Python ≈ 10 MB). Give it 10–30 seconds on the first click; after that it is instant. Best on Wi-Fi for the first run.

1 · Make the computer say something

The most basic thing code does is print — show a value on screen. In both languages the command is print(...). Text goes inside quotes. Press Run, then switch the tab from R to Python and Run again.

editable — change it and re-run

        

Notice how similar they are. That similarity is the whole reason we can teach them together — the ideas are the same; only small details of spelling differ.

2 · A tiny piece of real analysis

Say you surveyed five people and recorded their ages. Let's store those numbers and compute the average (mean) — the workhorse of any baseline report.

In R a list of numbers is made with c(...) (for "combine") and the average is mean(...). In Python we use a list [...] and compute sum(...) / len(...). Run both.

editable — change it and re-run

        
What just happened: you created a variable (ages), put five numbers in it, and ran a function over it. That is 80% of data analysis — data goes into a variable, a function does something to it, you read the result.

3 · Your turn

Change the numbers below to a small dataset of your own — maybe household sizes, or the number of children in five families — then Run. Try it in both R and Python.

this one is all yours

        

Where this course goes

This is the pilot lesson. The full 101 continues with real South Asian datasets — NFHS, ASER, PLFS, Census, Union Budget — building from "hello" to running an actual impact evaluation.

1

Your first line of code You are here

print, variables, a first calculation — in R and Python.

2

Data in, data out Coming

Read a real NFHS / ASER / PLFS file; look at rows and columns.

3

Wrangling Coming

Filter, select, group — tidyverse in R, pandas in Python.

4

Summaries & disaggregation Coming

Means and rates split by gender, caste, geography (ties to the Data Feminism lab).

5

Visualisation Coming

Your first chart — ggplot in R, matplotlib in Python.

6

Regression & impact evaluation Coming

Difference-in-differences, matching, IV — using open impact-evaluation datasets.

7

Reproducibility & sharing Coming

Scripts, comments, and sharing your analysis so others can rerun it.

RPythonWebR + PyodideNo installSouth Asia
Prefer to translate between languages? Try the Code Convert Pro tool — paste R and get Python (and Stata, SPSS), or the reverse.