Appendix A — Datasets and measurement units

A.1 Supplied teaching files

All CSV files use UTF-8 text, one header row, decimal points, and NA for missing values where applicable. scripts/generate-data.R deterministically regenerates the simulations using seed 531. They are educational constructions without a real geographical location or trial date.

File Unit of observation and size Main variables Status and limitations
crop_trial.csv, crop_trial.xlsx One experimental plot; 60 plots plot_id; block (1–5); treatment; variety (A/B); replicate (1/2); nitrogen_kg_ha; rainfall_mm; yield_t_ha Simulated balanced teaching trial. Water exposure varies by plot for illustration. Treatment and nitrogen are linked.
crop_dirty.csv Entry record; 61 rows Same variables as crop trial Simulated errors: exact duplicate, treatment spelling, two missing yields, P010 decimal error.
corrections.csv One checked correction plot_id, correct_yield_t_ha, reason Teaching ledger for P010 only; does not justify imputing missing yields.
soil.csv One composite soil sample per crop plot; 60 rows plot_id, soil_class, ph, available_n_mg_kg, available_p_mg_kg, available_k_mg_kg Simulated. pH is dimensionless; nutrient values are illustrative and not tied to a laboratory extraction method.
weather.csv One calendar month; 120 rows date (2015-01-01 through 2024-12-01), rain_mm, temp_c Simulated rainfall totals and monthly mean temperatures; not station observations.
growth.csv Independently harvested quadrat; 36 rows quadrat_id, day (days after sowing), biomass_g_m2 Simulated logistic growth with additive measurement variation, 3 quadrats at each of 12 dates.
paired_soil.csv One plot measured twice; 20 pairs plot_id, before_mg_kg, after_mg_kg Simulated available N. No untreated temporal control.
pest.csv One independently treated plot; 120 plots plot_id, treatment, infested (No/Yes) Simulated binary status at one assessment, 60 plots per treatment.
rcbd.csv One randomized treatment plot; 18 plots plot_id, block (1–6), treatment, yield_t_ha Simulated three-treatment complete blocks, one plot per block-treatment combination.
farm_yield.csv One independent teaching farm record; 100 rows farm_id, nitrogen_kg_ha, rainfall_mm, yield_t_ha Simulated linear relationship for regression practice; no real recommendation follows.

block and replicate are labels, not continuous response measurements. The simulated soil nutrient names indicate quantity and units but omit extraction protocols; a real data dictionary must state the method, depth, date, laboratory, and quality controls.

Download the teaching data

Save these files inside your project’s data/ folder before running chapter code: crop trial CSV, crop trial Excel, dirty crop entries, correction ledger, soil measurements, monthly weather, growth measurements, paired soil measurements, pest observations, blocked experiment, and regression records.

A.2 Real datasets bundled with R

PlantGrowth contains 30 dry-weight observations in three groups. Orange contains 35 repeated measurements on five trees, with age in days and circumference in millimetres. iris contains floral measurements in centimetres for three iris species. Their official help pages are linked in the references. Consult those sources for original provenance rather than assigning a new location or treatment meaning.

A.3 Historical series retained from the original chapter

The time-series chapter retains its original four worked datasets, followed by the agricultural weather application. All examples execute from local files. The retrieval script is scripts/download-original-data.R; running it is optional because the CSV copies are already supplied.

File Observations Meaning and source
original-kings.csv 42 Ages at death, in years, of successive English kings beginning with William the Conqueror; original teaching series. The index is succession order, not a regularly spaced calendar year.
original-births.csv 168 Monthly New York City births, in thousands, January 1946–December 1959; original series.
original-souvenir.csv 84 Monthly Australian souvenir-shop sales, in Australian dollars, January 1987–December 1993; original series.
original-rain.csv 100 Annual London rainfall, in inches, 1813–1912; copied from the author’s supplied rain.csv, originally linked to the historical precipitation series.

These series are real historical teaching examples and are not agricultural simulations. Births and souvenir sales illustrate seasonal structure; the kings example illustrates smoothing of a sequence but should not be described as equally spaced annual observations. The original iris.csv is also preserved in data/, with the column capitalization used in the import lesson. The built-in iris object uses different capitalization and punctuation; inspect names() before selecting variables.

The project preserves the author’s unedited lecture notes, images, rainfall CSV, assessment scripts, and document files in source-notes/. Their substantive explanations and illustrations are now included in the reading chapters, with code repairs and additions. The separately authored time-series PDF in the original folder is not repackaged as original textbook content.