Skip to main content

Data Appendix

Every dataset used in this book, in one place. The files live in the book’s practice/data/ folder; click a file name to download it. Put downloaded files in your own project’s data/ folder, untouched, and do all your work in a script.

The datasets fall into two groups. The first group is real data, drawn from the agencies cited with each entry. The second group is synthetic data constructed for this course; those files look like real farm records but the values are generated, so nothing in them describes an actual farm.

Real datasets

Saskatchewan RM crop yields

Average yields for every Saskatchewan Rural Municipality. Source: Saskatchewan Crop Insurance Corporation (2025a).

  • rm_yields_1990_2025.csv – the long form: 71,104 rows, one per RM-year-crop, for eight crops from 1990 to 2025. Columns Year, RM, Crop, Yield, Unit. Lentils are recorded in pounds per acre and every other crop in bushels per acre; the Unit column says which. Used in the Module 1 and Module 2 test banks.
  • rm_yields_1960_2025.csv – the same source taken back to 1960: 100,397 rows, 298 RMs, six crops. Built by practice/generate_data_module10_rm.py for the Module 10 assignment, and kept separate from the 1990 file so the Module 1 answer keys are undisturbed. Peas and lentils are excluded (not grown at scale here before the 1990s), canola begins in 1967 and durum in 1970, and zero yields are dropped as non-reports rather than crop failures.
  • rm_weather_1960_2025.csv – growing-season weather for every RM, 1960 to 2025, with that RM’s yields attached: 19,444 rows. Precipitation, growing degree days, and days above 30°C for May to August, from the sixteen stations the ten-year rm_weather.csv uses, matched to RMs the same way. Most of those sites are a chain of stations rather than one, so Station_Record, Climate_ID and Spliced record where each year came from and which years sit at a changeover. Built by data_scripts/eccc_pull_spliced.py and practice/build_rm_weather_long.R.
  • practice/data/rm_aci/ – the 2023 Annual Crop Inventory clipped to each of the 57 RMs assigned for the Module 10 assignment, 30 m, UTM 13N, about 190 KB each. Cut from AAFC’s provincial aci_2023_sk_v4.tif by practice/slice_aci_by_rm.R. Each student receives only their own.
  • rm_canola_yields_1990_2025.csv – the canola rows only, for the Module 2 test bank’s summary-statistics questions.
  • rm_yields_1990plus.csv – the wide form: 10,649 rows, one per RM-year, with one column per crop. Used in Module 1, where the wide layout suits PivotTables.
  • rm_yields_2015_2024.csv – a wide subset (2,950 rows, ten years, six crops) used in Modules 3, 4 and 7.

Saskatchewan variety yields

Variety-level yields and acres by SCIC risk zone. Source: Saskatchewan Crop Insurance Corporation (2025b).

  • sask_variety_yields.csv – 14,700 rows, one per risk-zone-crop-variety-year, risk zones 1 to 23, 2021 to 2025. Columns Risk_Zone, Crop, Variety, Year, Acres, Yield. Suppressed observations have missing acres and yield. The charts in Module 4 and the AI exercises in Module 5 are built from this file.
  • sask_barley_2025.xlsx / sask_barley_2025.csv – 2025 barley varieties, provincial acres and average yield. The workbook version has the title rows and multiple sheets that Module 3’s Excel-import section works through.

Manitoba wheat variety yields

MASC’s variety-level spring wheat yields by municipality, 2020 to 2025. Source: Manitoba Agricultural Services Corporation (2025).

  • mb_wheat_varieties.csv – 5,358 rows, one per municipality-variety-year. Columns Year, Municipality, Variety, Farms, Acres, Yield_bu_ac, Reported. Where too few farms grew a variety the row is suppressed for privacy: Reported is FALSE and the numeric columns are missing. Used in the Module 1 and Module 2 test banks.
  • mb_wheat_reported_2020_2025.csv – the 2,398 reported rows only.

Canada field crops

Statistics Canada’s provincial estimates of seeded area and yield. Source: Statistics Canada (2025).

RM lookup table

  • rm_lookup.csv – one row per Saskatchewan RM (296 rows): name, census division, 2021 population, and the nearest of sixteen weather stations with its distance. Compiled for this course from Statistics Canada 2021 Census counts. Used in Module 3’s merging chapter and in Module 7 to attach weather to yields.

Station precipitation

  • station_precip.csv – May-to-August precipitation for sixteen Saskatchewan weather stations, 2015 to 2024 (160 rows), with a count of days missing a reading. Compiled from Environment and Climate Change Canada historical climate records. Used in Module 3’s merging chapter and in Module 7’s functional-form section.

  • station_weather.csv – the same sixteen stations and years, with growing degree days and heat stress added to the precipitation (160 rows). GDD_base5 sums max(0, (Tmax + Tmin)/2 - 5) over May to August; ODD_above30 sums max(0, Tmax - 30), so a 35 °C day counts five times a 31 °C day, with Days_Above_30 as the plain count beside it. Pulled from the Environment and Climate Change Canada climate-daily API on 2026-10-14; its precipitation column reproduces station_precip.csv exactly, all 160 rows. The scripts that build it are in data_scripts/.

  • station_weather_daily.csv – the daily readings the file above is summarised from: one row per station per day, May 1 to August 31, 2015 to 2024 (19,680 rows), with Tmax_c, Tmin_c and Precip_mm. Missing readings are left empty rather than filled.

Kernen farm harvest, 2026

Two fields at the University of Saskatchewan’s Kernen Crop Research Farm, east of Saskatoon, exported from John Deere Operations Center. B-1 is 139 acres of InVigor 340LL canola cut on 29 September 2026, with a small cleanup pass on 6 October; C-1 is 152 acres of CDC Durango barley cut over 28 and 29 August. Module 9 works through the first four; the rest are there for practice and assignments.

  • kernen_b1_raw_10min.csv – the first ten minutes of the B-1 harvest exactly as the platform exported it, one row per header section per second, 42,662 rows. The starting point for 30  Working with Real Machinery Data.
  • kernen_c1_raw_10min.csv – the same for C-1, 32,235 rows. Not used by any chapter.
  • kernen_b1_raw_full.csv.zip – the whole B-1 harvest rather than ten minutes of it, 1,639,804 rows with the same columns. 13 MB zipped and 241 MB once unzipped, so read it with read_csv() and expect it to take a moment.
  • kernen_b1_raw_full.parquet – the same data in Parquet, 9.5 MB. arrow::read_parquet() returns exactly what read_csv() returns from the zipped version, and keeps IsoTime as a timestamp instead of text. Needs the arrow package.
  • kernen_b1_harvest.csv / kernen_c1_harvest.csv – the whole of each field collapsed to one row per second, with a column per quality flag and a keep column.
  • kernen_b1_grid20m.csv / kernen_c1_grid20m.csv – the same harvests averaged into 20 m cells, with elevation, moisture and (for B-1) distance to the nearest slough.
  • kernen_b1_yield_20m.tif / kernen_c1_yield_20m.tif – the same 20 m grids as four-layer rasters.
  • kernen_b1_boundary.geojson / kernen_c1_boundary.geojson – the field boundaries as drawn on the machine’s display.
  • kernen_b1_wetlands.geojson – the two sloughs in B-1, 6.8 and 0.7 acres. Digitised from the harvest file itself: the ground inside the boundary that the combine never covered. C-1 has none.
  • kernen_b1_ndvi.csv / kernen_c1_ndvi.csv – Sentinel-2 NDVI on every cloud-free date of the 2026 season, sampled at the centre of each 20 m cell. European Space Agency, via Microsoft’s Planetary Computer.
  • ndvi_raster.zip – Sentinel-2 NDVI for B-1 as 10 m rasters, eight images from mid-June to mid-September 2026, named by ISO week. That is the in-season window, and these are the weeks in it that cloud left usable; some files average two or three clear passes in the same week. Two of them (W32 and W36) cover only part of the field, the rest masked as cloud. 32  Merging Field Data with Satellite Data coarsens them to 20 m with aggregate() and puts the yield readings onto the same grid with rasterize(). GeoTIFFs are already compressed, so the 196 KB zip exists to make this one download rather than eight.
  • kernen_slc_soil.geojson / kernen_slc_components.csv – the Soil Landscapes of Canada polygon covering both fields, 45,899 hectares, with its eight soil components. Agriculture and Agri-Food Canada, version 3.2.
  • kernen_b1_yield_history.csv – five years of yield on the B-1 grid under a canola-wheat-barley rotation. Only 2026 is real. The earlier years are simulated from the real 2026 productivity surface so that patterns over time can be studied; every row carries a simulated column saying which it is.

Synthetic datasets

Fields E-1 and F-1

Two 120-acre fields used by the Module 9 test bank. They sit on real ground – the quarter sections are from the Saskatchewan legal land description grid, the cropped area inside each is a real field taken from the 2023 Annual Crop Inventory, the sloughs are the inventory’s own wetland class, and the NDVI images are real Sentinel-2 passes over that ground in 2026. The harvest readings are simulated. No producer farmed these fields in the way the files describe. They exist so that a bank question can ask for a number and be marked against an answer that is known, which no real field allows. practice/generate_fields_ef.R builds them.

  • field_e1_harvest.csv – E-1, NW-34-043-06-W3 in the RM of Blaine Lake, 116 acres of canola, 23,401 readings one per second. Columns iso_time, longitude, latitude, yield, moisture, speed_mph, width_ft, elevation, pass_num, field, crop, variety. No flag columns: working out what needs flagging is the exercise.
  • field_f1_harvest.csv – F-1, SE-16-045-05-W3, 123 acres of spring wheat, 24,637 readings. Same columns. It carries more than twice E-1’s share of partial-width readings, which is what makes it the harder of the two.
  • field_e1_boundary.geojson / field_f1_boundary.geojson – the cropped area of each quarter.
  • field_e1_wetlands.geojson / field_f1_wetlands.geojson – the sloughs, from the crop inventory.
  • ndvi_raster_ef.zip – Sentinel-2 NDVI at 10 m for both fields, 14 weeks for E-1 and 13 for F-1, named by ISO week. European Space Agency, via Microsoft’s Planetary Computer.

Canola trial

  • canola_trial.csv – 120 canola fields with fertilizer rate, growing-season rainfall, variety, and yield. Three fields have missing rainfall values, on purpose. This is the running example in Module 2’s data chapters and returns in Modules 3 and 7.

Field yields

  • field_yields.csv – sixty hypothetical canola fields with region, variety, acres, yield, and seeding date.

Saskatchewan wheat fields, 2025

  • sask_wheat_2025.csv – field-level wheat records with soil zone, variety, acres, yield, protein, and seeding rate. Constructed for the course; the soil-zone yield differences are patterned on real ones. Used in Module 6’s reporting examples, the Module 2 practice pages, and Module 7’s categorical-predictor section. Because the relationships in it were written into the generator rather than observed, it is for practising mechanics; conclusions about Saskatchewan wheat should come from the real RM and weather data.

Grain deliveries (messy)

  • grain_deliveries_messy.csv – elevator delivery tickets constructed to contain the problems Module 3’s cleaning chapter works through: inconsistent crop names, stray spaces, impossible values, duplicates.

Elevator tickets

Crop prices

  • crop_prices.csv – a handful of illustrative crop prices used in Module 5’s examples. Not market data.