Testthat and roxygen can still be utilized for non-package data analysis projects by following these steps:
Install and load the testthat and roxygen packages in your R environment.
Create a directory for your project and set it as your working directory.
Create a "tests" subdirectory within your project directory, where you can define your test files using testthat syntax.
Create a "data" subdirectory within your project directory, where you can store any data files needed for your analysis.
Use roxygen syntax to add comments and documentation to your code, including descriptions of functions and their parameters, example usage, and any assumptions or limitations.
Include the "roxygenize" command in your Makefile or build script to automatically generate documentation files based on your roxygen syntax.
Include the "test" command in your Makefile or build script to automatically run your test files and ensure that your code is functioning as expected.
By using testthat and roxygen in this way, you can ensure that your data analysis code is well-documented and thoroughly tested, even if it is not packaged in a formal R package.
Asked: 2023-05-27 20:06:24 +0000
Seen: 1 times
Last updated: May 27 '23