plant_trial: Simulated plant-science field trial (teaching dataset)

plant_trialR Documentation

Simulated plant-science field trial (teaching dataset)

Description

A simulated randomized complete block design (RCBD) with repeated measures, created for the rfriend course. It is engineered to exercise the full f_ workflow: data familiarisation, cleaning, transformation, test selection, and reporting. The data are simulated and must not be cited as empirical findings.

Usage

plant_trial

Format

A data frame with 60 rows and 8 variables:

block

Field block (B1-B5). Five blocks, the practical minimum number of replicates in plant research. Treat as a random effect: (1 | block).

plant_id

Plant identifier (P01-P20). One plant per treatment per block; each plant is measured repeatedly over time, so it is the repeated-measures grouping factor, nested in block: (1 | block/plant_id).

treatment

Experimental treatment (fixed effect), one of "control", "low_N", "high_N", "drought".

time_weeks

Weeks after the start of the trial: 2, 4 or 6. Stored as numeric; convert to a factor (e.g. with f_factors) before modelling time as a fixed factor.

height_cm

Plant height in centimetres. An approximately normal, clean continuous response (suited to f_aov, f_lmer, f_t_test).

biomass_g

Above-ground dry biomass in grams. Right-skewed, suited to demonstrating f_bestNormalize and f_boxcox.

chloroplast_count

Chloroplasts per mesophyll cell, counted under the microscope. A non-negative integer count, suited to a Poisson f_glm. Correlated with height_cm, so f_corplot shows a real relationship.

infected

Infection status, a factor with levels "no" and "yes". Use directly with f_chisq_test (paired with df_to_table); for a binomial f_glm, convert to 0/1 with as.numeric(infected == "yes").

Details

The intended mixed-model analysis is height_cm ~ treatment * factor(time_weeks) + (1 | block/plant_id), with treatment and time as fixed effects and block and plant as nested random effects. Treatment, time, and their interaction all have genuine effects built in. A deliberately messy raw version (inconsistent column names, injected outliers, missing values, and a stray factor label) and a wide-format version are distributed alongside the course materials for the import and cleaning modules.

Source

Simulated data. Generated by generate_course_data.R; see the course materials for the generating script and the random seed used.

Examples

data(plant_trial)
str(plant_trial)
## Not run: 
plant_trial$time_f <- factor(plant_trial$time_weeks)
f_lmer(height_cm ~ treatment * time_f + (1 | block/plant_id),
       data = plant_trial)

## End(Not run)

rfriend documentation built on July 7, 2026, 1:06 a.m.