Source
R 自带的 datasets::Orange。五棵橙树分别在七个时间点测量树干周长,一行是一棵树在某一天的一次测量。
这里的 CSV 由 R 4.5.1 自带数据原样导出;变量定义见 R 官方文档。
Use cases
- 多序列折线:比较五棵树随时间的生长轨迹
- 点线图:同时保留真实测量时点与趋势
- 分面小图:每棵树独立成图,比较增长速度
Trunk circumference of five orange trees measured at seven time points.
One row represents one measurement of one tree on one day.
R package · 收录于 2026-08-11
| Tree | age | circumference |
|---|---|---|
| 1 | 118 | 30 |
| 1 | 484 | 58 |
| 1 | 664 | 87 |
| 1 | 1,004 | 115 |
| 1 | 1,231 | 120 |
| 1 | 1,372 | 142 |
| # | 变量 | 类型 | 缺失 | 统计 |
|---|---|---|---|---|
| 1 | TreeTree identifier. | 整数 | — | min 1q1 —中位 3均值 3q3 —max 5 |
| 2 | ageDays since 1968-12-31. | 整数 | — | min 118.0q1 —中位 1,004均值 922.1q3 —max 1,582 |
| 3 | circumferencekeyTrunk circumference in mm. | 整数 | — | min 30.0q1 —中位 115.0均值 115.9q3 —max 214.0 |
library(readr)
orange <- read_csv(
"https://assets.evanzhou.org/tessera/csv/orange.csv",
col_types = cols(
Tree = col_integer(),
age = col_integer(),
circumference = col_integer()
)
)https://assets.evanzhou.org/tessera/csv/orange.csvR 自带的 datasets::Orange。五棵橙树分别在七个时间点测量树干周长,一行是一棵树在某一天的一次测量。
这里的 CSV 由 R 4.5.1 自带数据原样导出;变量定义见 R 官方文档。
# 产物写到 ../csv/orange.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", "orange.csv")
dir.create(dirname(out_csv), recursive = TRUE, showWarnings = FALSE)
write.csv(
as.data.frame(datasets::Orange),
out_csv,
row.names = FALSE
)表中统计由 scripts/profile_dataset.py 于 2026-08-11 数出。