This project is an R package that transpiles R functions to Fortran.
- To run the full test suite:
R -q -e 'devtools::test()'- To run the full
R CMD checklocally:
R -q -e 'rcmdcheck::rcmdcheck(error_on = "warning")'- To run a single test file:
R -q -e 'devtools::test_active_file("tests/testthat/test-dims2f.R")'- To see the generated C and Fortran code for an R function, use
r2f():
R --no-save -q <<'EOF'
devtools::load_all()
r2f(function(x) {
declare(type(x = double(NA)))
x + 1
})
EOF-
When running tests and snapshots need to be updated, use this workflow:
R -q -e 'testthat::set_max_fails(Inf); devtools::test(); testthat::snapshot_accept()'- Afterwards always review diffs of updated snapshots to confirm they match expectations.
-
Never disable or skip tests.
-
When adding tests, prefer user-facing API tests (e.g.
expect_quick_identical()); avoid asserting on generated Fortran/C translation strings. -
While troubleshooting and iterating towards a solution, you can run targeted single-file tests; before committing/pushing, always run the full test suite and
rcmdcheck. -
Prefer extending S7 classes with explicit properties over attaching arbitrary unchecked attributes.
-
README.md must only be generated by running:
R -q -e 'devtools::build_readme()'- Before wrapping up, always run:
air format .