Guide for creating DAAF agent definition files. Covers 12-section template, hook registration, skills-in-frontmatter, integration checklist. Use when adding or revising agents. For SKILL.md files, use skill-authoring instead.
中文简介正在准备中。当前显示原文说明。
R data manipulation with dplyr, tidyr, readr, purrr, stringr, forcats, lubridate. Verb pipelines, reshaping, joins, string/date ops, parquet via arrow. Includes data.table for performance. Use when execution language is R. Python equivalent: polars.
中文简介正在准备中。当前显示原文说明。
实测评分 未实测
查看安装方法安装前可以查看交给 AI 代理的指令内容。
R data manipulation with the core tidyverse packages: dplyr (verb-based data transformation), tidyr (reshaping and tidying), readr (fast delimited file I/O), purrr (functional iteration over lists and vectors), stringr (consistent string operations), forcats (factor manipulation for categorical data), and lubridate (date-time parsing and arithmetic). Also covers arrow for parquet I/O and data.table as a high-performance alternative for large datasets. Use when the execution language is R and the task involves data wrangling, reshaping, joining, string processing, date handling, or file I/O. Python equivalent: the polars skill.
The tidyverse is a collection of R packages that share a common design philosophy for data science:
filter(), select(), mutate(), summarize() describe what you want to do|> pipe chains.data pronoun)The tidyverse is not a single package but a curated set of packages that work together. This skill covers the data manipulation subset; for visualization see the ggplot2 skill; for statistical modeling see the r-stats skill.
Versions installed in the DAAF container (R 4.5.3):
| Package | Version | Key Notes |
|---|---|---|
| dplyr | 1.2.1 | .by inline grouping, reframe(), pick() |
| tidyr | 1.3.2 | pivot_longer()/pivot_wider() with .value sentinel |
| readr | 2.2.0 | Second-edition parser, read_csv() returns tibble |
| purrr | 1.2.2 | list_c(), list_rbind(), list_cbind() |
| stringr | 1.6.0 | Consistent str_* functions wrapping stringi |
| forcats | 1.0.1 | fct_na_value_to_level(), fct_cross() |
| lubridate | 1.9.5 | ymd() family, interval(), date arithmetic |
| data.table | 1.18.2.1 | DT[i, j, by] syntax, fread()/fwrite() |
| arrow | 23.0.1.2 | read_parquet()/write_parquet(), Arrow-dplyr integration |
dplyr 1.1+ changes to be aware of:
.by argument in mutate(), summarize(), filter(), slice_*() for inline grouping (no group_by() needed)reframe() replaces summarize() when results have multiple rows per grouppick() replaces across() inside cur_data() contextsrecode_values() for value-matching (simpler than case_when() for direct mappings; supersedes case_match(), which is soft-deprecated as of dplyr 1.2.0)consecutive_id() for run-length groupingjoin_by() for inequality and overlap joins| File | Purpose | When to Read |
|---|---|---|
quickstart.md | Core verbs: filter, select, mutate, group_by + summarize, arrange, pipe | Starting an R data pipeline, basic wrangling |
reshaping.md | pivot_longer, pivot_wider, separate, unite, nest/unnest | Converting between wide and long formats |
joins.md | left_join, inner_join, anti_join, semi_join, join keys, validation | Combining data frames |
io.md | Parquet via arrow, CSV via readr, Excel via readxl, remote fetching via httr2/glue, data import patterns | Reading or writing data files, fetching from HTTP APIs |
strings-dates.md | stringr ops (str_detect, str_replace, regex), lubridate (ymd, date arithmetic) | String processing or date handling |
purrr-functional.md | map/map_dfr/map2, walk, list-columns, nested data patterns | Iterating over lists or nested data |
factors.md | forcats: fct_relevel, fct_reorder, fct_lump, factor ordering | Categorical variable manipulation |
window-ranking.md | row_number, lag/lead, cumsum, ntile, rolling operations | Window functions and ranking within groups |
data-table.md | data.table DT[i, j, by] syntax, fread/fwrite, when to prefer over dplyr | Performance-critical operations on large data |
gotchas.md | NSE vs data masking, .data pronoun, across() patterns, group_by footguns | Debugging unexpected behavior |
quickstart.md then io.mdreshaping.mdjoins.mdstrings-dates.mddata-table.mdgotchas.md first| Skill | Relationship |
|---|---|
polars | Python equivalent -- covers the same data manipulation domain for Python pipelines |
data-scientist | Methodology routing -- determines which analysis to run; tidyverse implements it |
ggplot2 | Visualization -- takes tidy data produced by tidyverse and creates plots |
r-stats | Statistical modeling -- lm/glm, sandwich robust SEs, diagnostics; tidyverse prepares data for modeling |
fixest | Fixed effects regression -- high-dimensional FE, IV, DiD; tidyverse prepares data for fixest |
r-python-translation | Cross-language reference -- maps tidyverse to polars for bilingual annotation |
Data manipulation task?
├─ Select/drop columns → ./references/quickstart.md (select)
├─ Filter rows → ./references/quickstart.md (filter)
├─ Create/modify columns → ./references/quickstart.md (mutate)
├─ Sort rows → ./references/quickstart.md (arrange)
├─ Aggregate by group → ./references/quickstart.md (group_by + summarize)
├─ Reshape wide to long → ./references/reshaping.md (pivot_longer)
├─ Reshape long to wide → ./references/reshaping.md (pivot_wider)
├─ Join two data frames → ./references/joins.md
├─ Window functions (lag, rank) → ./references/window-ranking.md
└─ Large data performance → ./references/data-table.md
Type-specific operation?
├─ String matching/replacement → ./references/strings-dates.md (stringr)
├─ Date parsing/arithmetic → ./references/strings-dates.md (lubridate)
├─ Categorical/factor levels → ./references/factors.md (forcats)
└─ Iterate over lists → ./references/purrr-functional.md (purrr)
Data I/O?
├─ Read/write parquet (preferred) → ./references/io.md (arrow)
├─ Read/write CSV → ./references/io.md (readr)
├─ Read Excel → ./references/io.md (readxl)
├─ Fetch from HTTP API → ./references/io.md (httr2, glue)
└─ High-speed CSV for large files → ./references/data-table.md (fread)
In DAAF research pipelines, R transformations follow the file-first execution protocol -- code is written to .R script files and executed via the run_with_capture.sh wrapper, never run interactively.
The pattern:
scripts/stage{N}_{type}/{step}_{task-name}.Rbash {BASE_DIR}/scripts/run_with_capture.sh {PROJECT_DIR}/scripts/{script_name}.Rrun_with_capture.sh detects the .R extension and uses Rscript automatically_a.R, _b.R, etc.) for fixesRead agent_reference/SCRIPT_EXECUTION_REFERENCE.md for the complete protocol.
R script structure follows DAAF conventions:
# --- Config ---
library(dplyr)
library(arrow)
PROJECT_DIR <- "/daaf/research/YYYY-MM-DD_Project"
# --- Load ---
# INTENT: Load cleaned school-level data for analysis
df <- read_parquet(file.path(PROJECT_DIR, "data", "schools_clean.parquet"))
cat("Loaded:", nrow(df), "rows,", ncol(df), "columns\n")
# --- Transform ---
# INTENT: Calculate poverty rate by state
# ASSUMES: enrollment > 0 for all rows (validated in cleaning)
result <- df |>
mutate(poverty_rate = frl_count / enrollment) |>
group_by(state) |>
summarize(
avg_poverty = mean(poverty_rate, na.rm = TRUE),
n_schools = n(),
.groups = "drop"
) |>
arrange(desc(avg_poverty))
# --- Validate ---
stopifnot(nrow(result) > 0)
stopifnot(all(result$avg_poverty >= 0 & result$avg_poverty <= 1))
cat("States:", nrow(result), "\n")
cat("Range:", range(result$avg_poverty), "\n")
# --- Save ---
write_parquet(result, file.path(PROJECT_DIR, "data", "state_poverty.parquet"))
cat("Saved: state_poverty.parquet\n")
library(dplyr)
library(tidyr)
library(readr)
library(stringr)
library(lubridate)
library(arrow) # for parquet I/O
| Operation | Code | Package |
|---|---|---|
| Filter rows | `df | > filter(x > 5)` |
| Select columns | `df | > select(a, b, c)` |
| Create column | `df | > mutate(y = x * 2)` |
| Sort | `df | > arrange(desc(x))` |
| Group + summarize | `df | > group_by(g) |
| Rename | `df | > rename(new = old)` |
| Distinct rows | `df | > distinct(a, b)` |
| Count | `df | > count(group_col)` |
| Left join | `df1 | > left_join(df2, by = "key")` |
| Pivot longer | `df | > pivot_longer(cols, names_to, values_to)` |
| Pivot wider | `df | > pivot_wider(names_from, values_from)` |
| Read parquet | read_parquet("file.parquet") | arrow |
| Write parquet | write_parquet(df, "file.parquet") | arrow |
| Read CSV | read_csv("file.csv") | readr |
| String detect | str_detect(x, "pattern") | stringr |
| Parse date | ymd("2024-01-15") | lubridate |
| Native pipe | `df | > verb1() |
R 4.1+ provides the native pipe |> which passes the left-hand side as the first argument to the right-hand side. Use |> (not the magrittr %>%) for all DAAF pipelines:
# Native pipe -- preferred in DAAF
result <- df |>
filter(year == 2020) |>
mutate(rate = count / total) |>
group_by(state) |>
summarize(avg_rate = mean(rate)) |>
arrange(desc(avg_rate))
| Topic | Reference File |
|---|---|
| filter, select, mutate | ./references/quickstart.md |
| arrange, group_by, summarize | ./references/quickstart.md |
| Pipe operator | ./references/quickstart.md |
| slice, distinct, count | ./references/quickstart.md |
| across(), pick() | ./references/quickstart.md |
| case_when, if_else | ./references/quickstart.md |
| pivot_longer | ./references/reshaping.md |
| pivot_wider | ./references/reshaping.md |
| separate, unite | ./references/reshaping.md |
| nest, unnest | ./references/reshaping.md |
| complete, fill | ./references/reshaping.md |
| left_join, inner_join | ./references/joins.md |
| anti_join, semi_join | ./references/joins.md |
| Join keys, by argument | ./references/joins.md |
| Join validation | ./references/joins.md |
| read_parquet, write_parquet | ./references/io.md |
| read_csv, write_csv | ./references/io.md |
| Arrow integration | ./references/io.md |
| httr2, glue remote fetch | ./references/io.md |
| str_detect, str_replace | ./references/strings-dates.md |
| str_extract, regex | ./references/strings-dates.md |
| ymd, date arithmetic | ./references/strings-dates.md |
| Date components | ./references/strings-dates.md |
| map, map_dfr, walk | ./references/purrr-functional.md |
| List-columns | ./references/purrr-functional.md |
| fct_relevel, fct_reorder | ./references/factors.md |
| fct_lump, factor ordering | ./references/factors.md |
| row_number, lag, lead | ./references/window-ranking.md |
| cumsum, ntile | ./references/window-ranking.md |
| Rolling operations | ./references/window-ranking.md |
| DT[i, j, by] syntax | ./references/data-table.md |
| fread, fwrite | ./references/data-table.md |
| NSE and data masking | ./references/gotchas.md |
| .data pronoun | ./references/gotchas.md |
| Common pitfalls | ./references/gotchas.md |
When this library collection is used as a primary analytical tool, include in the report's Software & Tools references:
Wickham, H. et al. (2019). Welcome to the Tidyverse. Journal of Open Source Software, 4(43), 1686. https://doi.org/10.21105/joss.01686
Cite when: Tidyverse packages are the core data processing engine for the analysis. Do not cite when: Only used for trivial file I/O in a script primarily using another tool.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Guide for creating DAAF agent definition files. Covers 12-section template, hook registration, skills-in-frontmatter, integration checklist. Use when adding or revising agents. For SKILL.md files, use skill-authoring instead.
中文简介正在准备中。当前显示原文说明。
Researcher-facing analytic triangulation ("creative verification") for stress-testing provisional findings and designing pre-specified challenges before an analysis runs. Turns a researcher's concern or focal claim into competing explanations, bounded discriminating tests, audited diagnostic artifacts, and evidence-calibrated interpretations in a hypothesis/evidence ledger — behavioral, output-level verification replacing line-by-line code review. Covers 12 challenge families organized by Shadish-Cook-Campbell validity type, named sensitivity statistics, pre-committed interpretation rules, anti-fishing guardrails, and interactive diagnostic-artifact QA. Use in Ad Hoc Collaboration to verify, challenge, or stress-test a result, or to design discriminating tests before an analysis runs. Not code-change verification (verify skill / code review) and not final adjudication or re-execution (data-verifier, Reproducibility Verification) — prospective, hypothesis-driven challenge design of analytic claims.
中文简介正在准备中。当前显示原文说明。
In-situ smoke testing that verifies a LIVE DAAF deployment functions end-to-end in whatever provider route it is configured for. Auto-detects the active install route (anthropic-subscription, openrouter, chatgpt-subscription shim, openai-api shim) and runs tiered probes: Tier 0 free preflight (route/env coherence, hooks, statuslines, shim health); Tier 1 one live round-trip (~cents); Tier 2 a six-probe functional battery (dispatch, coding, web, skill loading, isolation-strip, nested-dispatch deny); Tier D a zero-cost deterministic battery (bats, Pester, lint, safety-hook tests). Use after install, after a rebuild or update, after any provider/config change (new API key, model remap, shim change), for pre-release validation, or when asked "is my install working" or to "smoke test the deployment/config." Requires the DAAF_DEV=1 dev image; a contributor tool, not end-user-facing. NOT DAAFBench (model behavioral-adherence evaluation under benchmarks/) and NOT scripts/smoke_tests/ (R/Python library-package smoke tests).
中文简介正在准备中。当前显示原文说明。
Operational framework for the DAAF orchestrator. Defines engagement modes, confirmation protocol, subagent dispatch, context budget, and reference-loading. Loaded exclusively by the orchestrator — not for subagents or user questions.
中文简介正在准备中。当前显示原文说明。
Data science methodology and method-selection routing for quantitative research. Covers EDA, data validation, descriptive analysis, causal inference (IV, DiD, RD, synthetic control), clustering/PCA/UMAP, supervised ML, geospatial analysis, network analysis, and visualization design. Contains the canonical method-to-library routing tree, routed by execution language — Python: statsmodels (OLS/GLM/time series), pyfixest (FE/DiD), linearmodels (RE/GMM/SUR), svy (complex surveys), scikit-learn (clustering/prediction ML), geopandas (spatial), igraph (network analysis); R: r-stats (OLS/GLM/time series), fixest (FE/DiD), plm (panel/RE/IV), survey-r (complex surveys), tidymodels (ML), sf-terra (spatial), igraph-r (network analysis). Load the routed tool-specific skill before giving tool-specific advice or writing code — library skills encode environment constraints and curated caveats absent from general knowledge.
中文简介正在准备中。当前显示原文说明。
Interpretation guidance for Urban Institute Education Data Portal datasets. The Portal is a curation layer over federal data: lowercase variable names, integer-encoded categoricals, standardized missing codes (-1 missing, -2 not applicable, -3 suppressed). Covers year definitions, grade encoding (grade=-1 is Pre-K, not missing), suppression rates, ODC-By licensing, and cross-source join identifiers. Load before analyzing any Portal data. Routes to source-specific deep-dive skills for individual datasets.
中文简介正在准备中。当前显示原文说明。