pseudocode-to-r
Translate pseudocode package to an R package whilst preserving behavior and generating verification tests. Use when translating pseudocode to R
- License 许可
- Apache-2.0
- 最近更新
- 2026-07-13
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- pseudocode-to-r
- description
- Translate pseudocode package to an R package whilst preserving behavior and generating verification tests. Use when translating pseudocode to R
02 资源文件 4
- 参考文档_AIWF_IMPORT.json349 B
- 参考文档references/experiment-playbook.md1.9 KB
- 参考文档references/statistics-reference.md1.5 KB
- 脚本scripts/sample_size_calculator.py3.0 KB
03 SKILL.md 正文
Pseudocode to R
Prompt the user for a location to create the new package. Suggest {../package-name R}
1. Setup
- Use renv to create a local environment and use this to install any required packages.
- Install the languageserver package to enable R LSP
2. Code translation
Translate the code in the pseudocode directory to an R package, whilst preserving behaviour, adapting idioms, and generating verification tests.
- Preserve original behaviour exactly
- Follow R tidyverse language idioms and conventions
- Maintain code structure when possible.
- Add appropriate R error handling.
- Include necessary imports and dependencies
3. Create a Shiny GUI to recreate any dlg files in the package directory.
4. Generate Tests
Create tests to verify package functions:
Test generation approach:
- Create new tests covering:
- Basic functionality for each function/method
- Edge cases (empty inputs, null values, boundary conditions)
- Error handling and exceptions
- Integration between components
5. Complete Documentation
Compare the documentation in the .sthlp and examples/ directory with the R directory. Port any missing elements from stata to the R package.
Look through the source files in the package for any additional documentation or history information and port it to the R package.
Use examples to create vignettes
6. Add open source infrastructure
- Copy the license file from the original package to the r package.
- Add a contributing guide to the r package
- Add a github workflow to run r tests on push to main, pull requests, and workflow dispatch
- add a .gitignore to r package
- Add a README to the r package
04 同仓库更多 Skills
translation-strategy
Decide whether it is worth translating a Stata package to other programming languages. Use before performing any translation.
stata-to-pseudocode
Translare Stata to psuedocode. Use before translating to other languages.
run-stata
Use the Rstata package to run stata code
hello
Greet the user with a friendly message
add-stata-tests-r
Iterates through each file in stata testing directory, summarises matching tests in R, adds missing tests, and summarises again. runs when user askes to "compare tests"
add-missing-tests
Iterates through each file in stata testing directory, summarises matching tests in R, adds missing tests, and summarises again. runs when user askes to "compare tests"