# Make two short lists of numbers (called vectors):
# the day, and the rainfall in millimeters on each day
day <- 1:5
rainfall_mm <- c(0, 12, 5, 0, 8)
# Look at the rainfall values
rainfall_mm
# Plot rainfall against day
plot(day, rainfall_mm)Code & Data
Every example in the book is built with real, runnable R code. The complete, chapter-by-chapter code and the datasets that go with it are available to readers of the book.
A taste of the code
Here is a short example of the kind of code you will write. It makes two small lists of numbers and plots them, just like the first plot in Chapter 1.
In the book, examples like this grow step by step into full Earth-data analyses, with each line explained for beginners.
Get the full code
New to coding? You do not need anything installed to begin. The entire first chapter is free on the Free Sample page. The complete code below is for when you want to run every example in the book yourself.
The complete, chapter-by-chapter code and all of the datasets are free for readers of the book. Tell us where to send them and we will email you the download.