Giao diện
← Quay lại Track R · ↑ R0 · → Workflow & Style
1) Mục tiêu module
- Thiết lập môi trường đủ sạch để code, chạy, và debug không “hên xui”.
- Chuẩn hóa kỷ luật dự án để tránh drift dependency theo thời gian.
2) Checklist (ship-ready)
✅ Checklist triển khai
Step 0 — Toolchain
- R (>= 4.x), IDE (RStudio/Positron), Git
- Cài
renvvà bật workflow lockfile
Step 1 — Project skeleton
- Tối thiểu:
R/,data/,scripts/,tests/,reports/ - Naming rõ: input/raw vs processed vs output
Step 2 — Smoke test
- Chạy 1 script đọc data nhỏ + xuất artifact
- Render 1 report (Quarto/Rmd) từ đầu đến cuối
Prerequisites
- Không yêu cầu.
Learning outcomes
- Khởi tạo project theo chuẩn
renvvà hiểu điểm fail thường gặp. - Tự chẩn đoán lỗi environment theo checklist (version, lib, path).
Pitfalls & Anti-patterns
- Cài package “tùy máy”, không lock → không tái lập.
- Trộn raw/processed/output chung một chỗ → không trace được nguồn dữ liệu.
Practice plan
- Tạo một repo demo:
renv::init(), commitrenv.lock. - Viết
scripts/smoke.RinsessionInfo()và render một report tối thiểu.