r-comparative-phylogeneticslisted
Install: claude install-skill coleoguy/tealc
# R Comparative Phylogenetics
## Execution Environment
R code runs via the `run_r_script` tool, which:
- Locates `Rscript` at `/opt/homebrew/bin/Rscript` (fallback: `which Rscript`)
- Creates a timestamped working directory under `data/r_runs/YYYYMMDD_HHMMSS/`
unless `working_dir` is specified explicitly
- Prepends `agent/r_runtime/preamble.R` to every script
- Saves the full script as `working_dir/script.R` for reproducibility
- Returns JSON: `stdout`, `stderr`, `exit_code`, `working_dir`, `plot_paths`,
`created_files`
Always tell Heath the `working_dir` path so he can inspect plots and outputs
directly. For long analyses, write intermediate results to disk rather than
holding everything in the R session.
### Preamble (auto-prepended)
```r
options(warn = 1, stringsAsFactors = FALSE)
set.seed(42)
suppressPackageStartupMessages({
# Loaded by default; per-run libraries appended after
})
```
`stringsAsFactors = FALSE` is always active — do not fight it. `set.seed(42)` is
set globally; override inside your script if a different seed is needed for a
specific analysis.
---
## Mandatory Preflight: Data Resource Resolution
Before emitting any R code that reads a lab database, call
`require_data_resource(key)`. Use the returned `OK|<path>` string verbatim.
```r
# After require_data_resource("coleoptera_karyotypes") returns
# "OK|/Users/blackmon/Desktop/GitHub/coleoguy.github.io/data/karyotypes-coleoptera.csv"
dat <- read.csv("/Users/blackmon/Desktop/GitHub/coleoguy.gi