r-package-development
/r-package-development
Wspiera tworzenie pakietów R z devtools, testthat i roxygen2: testy, dokumentacja i infrastruktura pakietu.
- Autor
- posit-dev ↗
- Repozytorium
- skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 15.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 15.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Wspiera tworzenie pakietów R z devtools, testthat i roxygen2: testy, dokumentacja i infrastruktura pakietu.
Oryginalny opis (EN)
R package development with devtools, testthat, and roxygen2. Use when the user is working on an R package, running tests, writing documentation, or building package infrastructure.
Jak działa
- Key commands
- Coding
- Testing
- Documentation
- NEWS.md
Podgląd SKILL.md
---
name: r-package-development
description: R package development with devtools, testthat, and roxygen2. Use when the user is working on an R package, running tests, writing documentation, or building package infrastructure.
metadata:
author: Simon P. Couch (@simonpcouch)
version: "1.2"
---
# R package development
## Key commands
```
# Run code in the package
Rscript -e "devtools::load_all(); code"
# Run all tests
Rscript -e "devtools::test()"
# Run all tests for files starting with {name}
Rscript -e "devtools::test(filter = '^{name}')"
# Run all tests for R/{name}.R
Rscript -e "devtools::test_active_file('R/{name}.R')"
# Run a single test "blah" for R/{name}.R
Rscript -e "devtools::test_active_file('R/{name}.R', desc = 'blah')"
# Redocument the package
Rscript -e "devtools::document()"
# Check pkgdown documentation
Rscript -e "pkgdown::check_pkgdown()"
# Check the package with R CMD check
Rscript -e "devtools::check()"
# Format code
air format .
```
## Coding
* Always run `air format .` after generating code.
* Use the base pipe operator (`|>`) not the magrittr pipe (`%>%`).
* Use `\() ...` for single-line anonymous functions. For all other cases, use `function() {...}`.
## Testing
- Tests for `R/{name}.R` go in `tests/testthat/test-{name}.R`.
- All new code should have an accompanying test.
- If there are existing tests, place new tests next to similar existing tests.
- Strive to keep tests minimal with few comments.
- Avoid `expect_true()` and `expect_false()` in favour of a specific expectation which will give a better failure message.
- When testing errors and warnings, don't use `expect_error()` or `expect_warning()`. Instead, use `expect_snapshot(error = TRUE)` for errors and `expect_snapshot()` for warnings because these allow the user to review the full text of the output.
## Documentation
- Every user-facing function should be exported and have roxygen2 documentation.
- Wrap roxygen comments at 80 characters.
- Internal functions should not have roxygen documentation.
- Whenever you add a new (non-internal) documentation topic, also add the topic to `_pkgdown.yml`.
- Always re-document the package after changing a roxygen2 comment.
- Use `pkgdown::check_pkgdown()` to check that all topics are included in the reference index.
## `NEWS.md`
- Every user-facing change should be given a bullet in `NEWS.md`. Do not add bullets for small documentation changes or internal refactorings.
- Each bullet should briefly describe the change to the end user.
- If the change is related to a function, put the name of the function early in the bullet.
- If the bullet is related to a GitHub issue or pull request, reference it by number in parentheses before the final period: `(#123).`.
- Order bullets alphabetically by function name. Put all bullets that don't mention function names at the beginning.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · posit-dev/skills | 100 | MIT |
| ab604/claude-code-r-skills | 95 | MIT |
Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 13.11.2026 · wersja paczki 958deb10cb0d (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 1 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100r-testthat
Pisze testy pakietu R w testthat 3+: strukturę, oczekiwania, sprzątanie z withr, fixtury, mocki i testy snapshotowe. - 100r-package-quality
Podnosi jakość pakietu R: czyste reguły kodu, testy testthat, pokrycie covr, formatowanie styler, lintr i bramkę devtools::check(). - 95tdd-workflow
Prowadzi pracę w R przez test-first z testthat, przy nowych funkcjach, poprawkach i refaktoryzacji, z pokryciem co najmniej 80 proc. - 100game-qa
Pisze i uruchamia testy gier w przeglądarce przez protokół DevTools: testy regresji wizualnej, rozgrywki i wydajności. - 100rlang-conditions
Pomaga obsługiwać błędy, ostrzeżenia i warunki w pakietach R: cli_abort, kontekst wywołania, walidację argumentów, łączenie błędów przez try_fetch() i testy snapshotów w testthat. - 86package-development
Rejestruje pakiet w workspace, czyni prywatny pakiet publikowalnym, zmienia jego nazwę lub ścieżkę.