| plant_trial | R Documentation |
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.
plant_trial
A data frame with 60 rows and 8 variables:
Field block (B1-B5). Five blocks, the practical
minimum number of replicates in plant research. Treat as a random
effect: (1 | block).
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).
Experimental treatment (fixed effect), one of
"control", "low_N", "high_N", "drought".
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.
Plant height in centimetres. An approximately normal,
clean continuous response (suited to f_aov,
f_lmer, f_t_test).
Above-ground dry biomass in grams. Right-skewed, suited to
demonstrating f_bestNormalize and f_boxcox.
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.
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").
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.
Simulated data. Generated by generate_course_data.R; see the
course materials for the generating script and the random seed used.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.