Plot a column to spot odd values in R¶
Draft: not yet validated
The code on this page was run inside MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. Tell us what you find.
A table of 152 numbers hides what a picture shows in a second. This check suits any column of measurements, whoever or whatever produced it.
You will: have found one reading and one gauge in readings that do not sit with
the rest, from a chart.
Time: 10 minutes. You need: the readings and gauges tables from
Load a file from your Data Store in RStudio, in
MESA RStudio Geospatial.
Steps¶
-
In the Console, draw one box per gauge:
boxplot(value ~ gauge_id, data = readings)You should see: a chart in the Plots pane, with five boxes squashed below 35 and a single circle near 180 above G05.
-
Find the row behind the circle:
readings[readings$value > 100, ]You should see:
gauge_id date value flag 130 G05 2026-07-09 180 S -
One extreme value sets the scale for everything else. Draw the chart again without it, to look at the rest:
boxplot(value ~ gauge_id, data = readings[readings$value < 100, ])You should see: the axis now ends near 35. Four gauges reach 25 to 33. The box for G02 stays under 3.
-
A gauge ten times lower than its neighbours is either in a much drier place or on a different scale. Look at the gauge table:
gaugesYou should see:
cmin theunitcolumn for G02, andmmfor the others.gauge_id name unit elevation_m 1 G01 Boathouse mm 512 2 G02 Orchard cm 540 3 G03 Observatory mm 688 4 G04 Depot mm 521 5 G05 Quarry mm 603 -
Write down, as comments in your script or in a notes file, the two things the chart showed and what you would do about each before computing with
value.You should see: a note such as "G05 has one reading of 180 on 2026-07-09, flagged S. G02 is recorded in cm, the others in mm."
Check it worked¶
You can name the date of the odd reading and the gauge on a different scale, and you found both from the chart before you looked at any row.
If it didn't¶
No chart appears. The Plots pane may be hidden behind Files or Help at the bottom right. Click the Plots tab.
The second chart looks like the first. The filter was left out. Check that the
line ends data = readings[readings$value < 100, ]).
Next¶
- Tally a quality flag in R,
for what the
Son that row means. - Bring two units onto one scale in R, to put G02 on the same scale as the others.
- Reference: boxplot in the R documentation.
Not yet validated by a person in MESA RStudio Geospatial. Drafted with AI assistance on 2026-11-17; the code was run there that day (R 4.6.2).
Machine-readable versions of this page: Markdown twin · raw source on GitHub · llms.txt · llms-full.txt (whole site). See For AI agents.