Source
R 自带的 datasets::PlantGrowth。三十株植物分为对照、处理 1 和处理 2 三组,每组十条,响应变量是植物干重。
这里的 CSV 由 R 4.5.1 自带数据原样导出;实验出处与示例见 R 官方文档。
Use cases
- 箱线图:比较三个处理组的中位数与四分位范围
- 小提琴 + 原始点:同时看分布形态与全部观测
- 均值误差图:展示组间平均水平及不确定性
Dried weight of thirty plants under a control and two treatment conditions.
One row represents one plant.
R package · 收录于 2026-08-11
| weight | group |
|---|---|
| 4.17 | ctrl |
| 5.58 | ctrl |
| 5.18 | ctrl |
| 6.11 | ctrl |
| 4.5 | ctrl |
| 4.61 | ctrl |
| # | 变量 | 类型 | 缺失 | 统计 |
|---|---|---|---|---|
| 1 | weightkeyDried plant weight. | 双精度 | — | min 3.59q1 —中位 5.15均值 5.07q3 —max 6.31 |
| 2 | groupctrl is the control. trt1 and trt2 are the two treatments. | 字符型 | — | 不同值 3ctrl · trt1 · trt2 |
library(readr)
plant_growth <- read_csv(
"https://assets.evanzhou.org/tessera/csv/plant_growth.csv",
col_types = cols(
weight = col_double(),
group = col_character()
)
)https://assets.evanzhou.org/tessera/csv/plant_growth.csvR 自带的 datasets::PlantGrowth。三十株植物分为对照、处理 1 和处理 2 三组,每组十条,响应变量是植物干重。
这里的 CSV 由 R 4.5.1 自带数据原样导出;实验出处与示例见 R 官方文档。
# 产物写到 ../csv/plant_growth.csv —— 脚本和 CSV 是 content/tessera/data/ 下固定的兄弟目录,
# 所以按脚本自身定位,不依赖你在哪个目录敲这条命令。csv/ 不进仓库(见 .gitignore)。
#
# Rscript 时路径在 --file= 里,source() 时在 sys.frame()$ofile 里,两种都要认:
# 只取其中一种的话,另一种跑法会静默地把 CSV 写到当前目录去。
script_dir <- local({
arg <- grep("^--file=", commandArgs(trailingOnly = FALSE), value = TRUE)
path <- if (length(arg)) sub("^--file=", "", arg[[1L]]) else sys.frame(1)$ofile
dirname(normalizePath(path, mustWork = TRUE))
})
out_csv <- file.path(script_dir, "..", "csv", "plant_growth.csv")
dir.create(dirname(out_csv), recursive = TRUE, showWarnings = FALSE)
write.csv(
datasets::PlantGrowth,
out_csv,
row.names = FALSE
)表中统计由 scripts/profile_dataset.py 于 2026-08-11 数出。