NASA’s GISS Surface Temperature Analysis (GISTEMP v4) reports how much warmer or cooler the Earth’s average surface temperature was each month, compared with the 1951–1980 average (NASA GISTEMP). The table is wide: each row is a year from 1880 to today, and each month has its own column. Analysis question: How much has the world warmed since the late 1800s, and which years were the warmest?
Data Source
I downloaded the “Global-mean monthly, seasonal, and annual means” CSV file for land and ocean (GLB.Ts+dSST.csv) on November 28, 2026. I saved it without changes as data/nasa_gistemp_global_raw.csv in my GitHub repository. NASA updates this file every month, so I read my saved copy from GitHub to make sure the results can be reproduced.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
theme_set(theme_minimal(base_size =12)) # same chart style in all three datasetsraw_url <-"https://raw.githubusercontent.com/YaldaAzamee/data607-project2/main/data/nasa_gistemp_global_raw.csv"# The first line of the file is a title ("Land-Ocean: Global Means"), not the headerread_lines(raw_url, n_max =3)
[1] "Land-Ocean: Global Means"
[2] "Year,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,J-D,D-N,DJF,MAM,JJA,SON"
[3] "1880,-.19,-.25,-.10,-.17,-.10,-.21,-.19,-.11,-.15,-.23,-.22,-.18,-.18,***,***,-.12,-.17,-.20"
raw <-read.csv(raw_url, skip =1, check.names =FALSE)
Data Structure Before Tidying
The raw data has 147 rows and 19 columns. The column names are:
Jan to Dec are monthly values. They are one variable (temperature anomaly) spread across 12 columns, which is why the table is wide.
J-D (January–December annual mean), D-N (December–November mean), and DJF, MAM, JJA, SON (seasonal means) are summaries calculated from the months.
Missing values are written as ***, so R reads these columns as text instead of numbers.
Transformation Steps
Step 1: Keep the monthly columns and reshape from wide to long
The annual and seasonal columns can be calculated from the monthly values, so keeping them would store the same information twice. I keep only Year and the 12 months, then stack the month columns into rows with pivot_longer().
long <- raw |>select(Year, all_of(month.abb)) |>pivot_longer(cols =all_of(month.abb),names_to ="month",values_to ="anomaly",# Columns with "***" were read as text and the others as numbers;# convert all to text so they can be stacked into one columnvalues_transform = as.character )head(long)
# A tibble: 6 × 3
Year month anomaly
<int> <chr> <chr>
1 1880 Jan -0.19
2 1880 Feb -0.25
3 1880 Mar -0.1
4 1880 Apr -0.17
5 1880 May -0.1
6 1880 Jun -0.21
Step 2: Normalize the variable structure
Missing values: I convert the *** text to NA and change anomaly from text to a number.
Month: I make it an ordered factor (Jan < Feb < …), so months sort in calendar order instead of alphabetically, and add the month number.
Decision: the only missing values are the months of the current year that have not happened yet, because the file was downloaded before the year ended. They are not errors, so I remove them. I also add a column complete_year that is TRUE only when a year has all 12 months. That way the current, partial year is not compared with full years, which would be unfair: the missing months might be warmer or cooler.
# A tibble: 6 × 5
year month anomaly_c month_num complete_year
<int> <ord> <dbl> <int> <lgl>
1 1880 Jan -0.19 1 TRUE
2 1880 Feb -0.25 2 TRUE
3 1880 Mar -0.1 3 TRUE
4 1880 Apr -0.17 4 TRUE
5 1880 May -0.1 5 TRUE
6 1880 Jun -0.21 6 TRUE
The final tidy dataset has 1762 rows, one per month, from 1880 to 2026.
Analytical Methods
All analysis uses the tidy dataset temp_tidy, and only complete years. The values are anomalies: the difference, in °C, between that month’s global temperature and the average for the same month in 1951–1980. A positive value means warmer than that average.
I calculate the annual mean anomaly for each year by averaging its 12 months.
I calculate the average for each decade (1880s, 1890s, …) to show the long-term trend without year-to-year noise.
I list the five warmest years.
Analysis
annual <- temp_tidy |>filter(complete_year) |>group_by(year) |>summarise(annual_anomaly_c =mean(anomaly_c))decades <- annual |>mutate(decade =paste0(year - year %%10, "s")) |>group_by(decade) |>summarise(years =n(),mean_anomaly_c =round(mean(annual_anomaly_c), 2) )decades |>rename(Decade = decade, `Years with data`= years,`Mean anomaly (°C vs. 1951–1980)`= mean_anomaly_c) |> knitr::kable(caption ="Average global temperature anomaly by decade")
Average global temperature anomaly by decade
Decade
Years with data
Mean anomaly (°C vs. 1951–1980)
1880s
10
-0.21
1890s
10
-0.24
1900s
10
-0.31
1910s
10
-0.33
1920s
10
-0.24
1930s
10
-0.12
1940s
10
0.04
1950s
10
-0.05
1960s
10
-0.03
1970s
10
0.03
1980s
10
0.25
1990s
10
0.39
2000s
10
0.59
2010s
10
0.80
2020s
6
1.06
annual |>slice_max(annual_anomaly_c, n =5) |>mutate(annual_anomaly_c =round(annual_anomaly_c, 2)) |>rename(Year = year, `Annual mean anomaly (°C)`= annual_anomaly_c) |> knitr::kable(caption ="Five warmest years on record")
Five warmest years on record
Year
Annual mean anomaly (°C)
2024
1.28
2025
1.19
2023
1.17
2016
1.01
2020
1.00
ggplot(annual, aes(year, annual_anomaly_c)) +geom_hline(yintercept =0, color ="grey50") +geom_col(aes(fill = annual_anomaly_c >0), width =0.8) +geom_smooth(aes(color ="Smoothed trend"), method ="loess", span =0.15, se =FALSE, linewidth =1) +scale_fill_manual(values =c(`TRUE`="#D55E00", `FALSE`="#0072B2"),labels =c(`TRUE`="Warmer than 1951–1980", `FALSE`="Cooler than 1951–1980")) +scale_color_manual(values =c(`Smoothed trend`="black")) +scale_x_continuous(breaks =seq(1880, 2030, 20)) +labs(title ="Global Surface Temperature Anomaly, 1880–present",subtitle ="Annual mean of monthly values, complete years only",x ="Year",y ="Anomaly (°C vs. 1951–1980 average)",fill =NULL,color =NULL )
`geom_smooth()` using formula = 'y ~ x'
Conclusions
Findings
The world has warmed by about 1 °C. The average anomaly rose from -0.21 °C in the 1880s to 0.8 °C in the 2010s, the most recent complete decade.
Most of the warming happened after 1980. The decade average rose from 0.03 °C in the 1970s to 0.8 °C in the 2010s, and the first 6 years of the 2020s average 1.06 °C.
The warmest years are all recent. The warmest year was 2024 (1.28 °C), and all five warmest years are from 2016 or later.
AI Use
Anthropic. (2026). Claude Opus 5.5 [Large language model]. https://claude.ai. Accessed November 28, 2026. Used to help select the dataset, plan the tidying steps, and write and debug the code. I reviewed and tested all code.