Day 10 — A first biological report

Lecture slides · Quiz · Weekly revision

Today’s question

What can we honestly say about seedling growth from these measurements? Today you write a short report that answers that question for a reader who was not in the room: what was measured, how growth was calculated, what the figure shows, and what we cannot conclude yet. It uses everything from days 6–9, and it must render on a fresh R session so that anyone can rerun it.

Open the project, open report.Rmd, and use Save As to save a copy as first-report.Rmd in the project folder, so the data/ paths keep working. The rendered HTML can go into reports/.

Save today: first-report.Rmd and its HTML.

What a reader needs

A short report has four parts, each answering one question a reader has:

  1. Question and data: what did you want to know, and what was measured?
  2. Methods: how did you get from the file to the result?
  3. Results: what does the figure show, and which numbers matter?
  4. Interpretation: what do the results mean, and what can they not tell us?

The study is described in data/README.md: 24 seedlings in separate pots, 12 randomly allocated to a nutrient treatment and 12 to a control, each measured at the start and after seven days, in mm. The nutrient is not specified, and the data are simulated. Put these facts in your first section; the reader cannot see the dictionary.

Methods and simple checks

Write the method in words a biologist understands: “Growth was calculated as final minus initial length for each plant, in mm.” That says more than “we used mutate()”. The code goes in the report too, so the calculation can be rerun:

library(readr)
library(dplyr)
library(ggplot2)
seedlings <- read_csv("data/seedlings.csv", show_col_types = FALSE)
seedlings <- mutate(seedlings, growth_mm = final_mm - initial_mm)

Then use three short checks to find out whether the data are complete and plausible, and report the answers:

nrow(seedlings)
sum(is.na(seedlings$growth_mm))
range(seedlings$growth_mm)

There are 24 plants, no missing growth values, and growth ranges from 8.0 to 30.8 mm. So every plant was measured, and every plant grew.

The figure, and what to say about it

Use the growth-by-treatment plot from day 8, with every plant as a point, growth in mm on the y-axis, and a caption saying that each point is one independently potted plant.

Then describe it. Good sentences say something specific that the reader can see in the figure:

  • “Growth varied among plants in both groups.”
  • “Treated plants tended to grow more: controls grew 8.0–18.7 mm and treated plants 12.2–30.8 mm, but the groups overlap.”

Two sentences go too far. “Every treated plant grew more than every control” is false: P17 (treated) grew 12.2 mm, less than most controls. “The treatment works” needs an estimate of how uncertain the difference is, which comes in week 4. A fair limitation is that this is one small, simulated study.

mean(seedlings$growth_mm) gives 18.4 mm, but that mixes both groups, so it does not answer whether they differ. Group means come in week 3.

Writing the report

Write the four sections in first-report.Rmd:

  1. Question and data: the question, the design (number of plants, groups, random allocation, simulated data) and what one row is.
  2. Methods: how the file was read and growth calculated, in words, with the code chunk and its relative path, and the unit.
  3. Results: the labelled figure and the three checks. Use inline code for at least one number, such as the number of plants.
  4. Interpretation: the pattern, the variation among plants, and one limitation.

Restart R and render from the Console (not inside the report):

rmarkdown::render("first-report.Rmd", output_dir = "reports")

If it fails, start from the first error and add whatever the report is missing.

Leaf area and leaf mass

Does a larger leaf also weigh more? The file data/leaf-mass.csv has one leaf from each of 18 plants, with its area in cm² and its dry mass in mg. In a script leaf-first-look.R, read it into leaves and draw a scatter plot with leaf_area_cm2 on the x-axis and dry_mass_mg on the y-axis, with units in the axis labels.

The points lie close to a rising line: leaves from 2.96 to 14.68 cm² weigh from 21.19 to 71.33 mg, and larger leaves are heavier. No treatment was applied here; the plot shows that the two measurements go together in these plants.

Start with leaves <- read_csv("data/leaf-mass.csv", show_col_types = FALSE), then reuse the ggplot() code from day 8 with the new table, the new columns, new axis labels and geom_point() without jitter.

Reading your report as a stranger

Open the HTML in a browser, without looking at the .Rmd, and read it as someone who has never seen the data. Note every problem and how you fixed it in reports/report-revision.txt.

  1. Can you find the question, the input file, the number of plants, the two groups, the unit, and what one point in the figure is? Add whatever is missing to the .Rmd, not to the HTML, which is replaced at every render.
  2. Take three sentences from your interpretation and find, for each, the figure, number or dictionary fact that supports it. Rewrite any sentence nothing supports, such as one claiming every treated plant grew more.
  3. If you have two figures (initial versus final length, and growth by group), keep the one that answers your question. For “did treated plants grow more?” that is growth by group, because its y-axis is growth.
  4. Restart R, render again, and check that the HTML shows your corrections.

“In this sample, treated plants tended to grow more, but the groups overlap” can be checked against the points. “The treatment always increases growth” goes far beyond 24 simulated plants. Before week 4, describe the pattern, the overlap and the limits of the study.

A second, smaller brief

Write a second short report, laboratory-brief.Rmd in the project folder, about one of these tables, with the same four sections:

  • The 18-plant transfer study (data/seedlings-transfer.csv): did treated plants grow more in the second class’s experiment? There are 18 plants, 9 per group, and T01 grew 15.0 mm.
  • The solution recipes (data/solutions.csv): what concentration does each recipe give? Use 1000 * (mass_g / molar_mass_g_mol) / (final_volume_ml / 1000) for mmol/L. Each substance gives 50, 100 and 150 mmol/L. The masses differ between the substances because glucose molecules are heavier than sodium chloride, so the same concentration needs more grams.

For either choice:

  1. Say what one row is: one plant, or one recipe. For the recipes, define mole and molar mass as on day 6.
  2. Check the table’s size, column types and missing values, and report them.
  3. Calculate growth or concentration, make one labelled figure, and save it with a derived table as output/laboratory-brief-...png and .csv.
  4. Write the interpretation with one limitation for this study: for plants, the small sample and overlap; for recipes, that the values follow from a formula, not from measured variation.
  5. Restart R and render. Then copy the brief with its data and .Rproj to a practice folder, render it there, and note the folder in report-revision.txt.

Completion check

Open your HTML in a browser. Can you find the question, the units, what one dot is, and the main limitation? Then restart R and check that the saved .Rmd renders.

The .Rmd contains the imports, the growth calculation and the plot. The HTML reads sensibly without the code. There is no personal path such as C:/Users/anna/Desktop anywhere in the source.

Keep: first-report.Rmd, its HTML, and leaf-first-look.R if completed. Next: what happens when a laboratory table is imperfect?