diff --git a/clt4nqypo000709jr5pa39o5n.md b/clt4nqypo000709jr5pa39o5n.md new file mode 100644 index 0000000..92882d6 --- /dev/null +++ b/clt4nqypo000709jr5pa39o5n.md @@ -0,0 +1,470 @@ +--- +title: "Unveiling the Ultimate "R Package Developer Master Resource List"" +seoTitle: "R Package Development Resources" +seoDescription: "Resources for the R Package Developer" +datePublished: Tue Feb 27 2024 05:00:00 GMT+0000 (Coordinated Universal Time) +cuid: clt4nqypo000709jr5pa39o5n +slug: unveiling-the-ultimate-r-package-developer-master-resource-list +cover: https://cdn.hashnode.com/res/hashnode/image/upload/v1707151466448/fa9f1cf4-87c0-4276-b2ac-d06998cf4ac5.png +ogImage: https://cdn.hashnode.com/res/hashnode/image/upload/v1710012317304/27960c34-60db-44c4-a002-5b08c35005f7.png +tags: productivity, r, lists, package-development + +--- + + + + + +## Overview + +> This article aims to provide an exhaustive list of helpful tools, packages, and resources for developers, authors, maintainers, reviewers, and stakeholders in the R Package development workflow. + +Welcome to the world of R Package Development! Whether you're a seasoned R programmer looking to expand your toolkit or a newcomer eager to dive into the exciting realm of package development, you've come to the right place. In this comprehensive guide, we'll unveil the essential resources every R package developer needs to master their craft. From tutorials and books to online communities and tools, we've curated a treasure trove of resources to help you embark on your journey towards becoming a proficient R package developer. + +Throughout this article, I will provide a walkthrough of the various packages, tools, resources, and axioms I have encountered over my years as an R package software engineer. + +## R User vs. R Developer + +In the world of R programming, there are distinct roles and distinctions between an *R User* and an *R Developer*, each with its own set of responsibilities, skills, and objectives. + +To distinguish, R developers *develop* new innovative solutions while R Users *use* the tools and packages that the developers created. This article is aimed towards the development side of the spectrum and attempts to provide a comprehensive, curated toolbox for the R Developer, specifically in regard to developing R Packages. + +In summary, while both R users and R developers utilize R for data analysis and statistical computing, they differ in their focus and expertise. R users primarily leverage R for data analysis tasks, while R developers specialize in creating and maintaining R packages to enhance the functionality and capabilities of the R programming language for a broader audience of users. + +### R Users + +- **Definition:** An R user is someone who primarily utilizes R for data analysis, statistical modeling, visualization, and other tasks related to data science, research, or analytics. + +- **Skills & Responsibilities:** + - Proficient in using R for data manipulation, exploration, and analysis. + - Familiarity with statistical methods and techniques for interpreting data. + - Ability to create visualizations and plots to communicate insights effectively. + - Understanding of data structures, functions, and packages within R. + - May use R for tasks such as data cleaning, hypothesis testing, regression analysis, and machine learning + +- **Objectives:** + - Analyze and interpret data to derive meaningful insights and make data-driven decisions. + - Communicate findings through reports, presentations, or visualizations. + - Utilize R packages and libraries to streamline analysis workflows and enhance productivity. + - Collaborate with colleagues or stakeholders to address specific analytical needs or research questions. + +### R Developer + +- **Definition:** An R developer is someone who focuses on creating, maintaining, and extending R packages, libraries, and tools for the broader R community. + +- **Skills and Responsibilities:** + - Proficiency in programming with R, including knowledge of object-oriented programming principles, functions, and package development. + - Understanding of software engineering practices such as version control, testing, and documentation. + - Ability to design, implement, and maintain R packages to address specific needs or solve particular problems. + - Familiarity with R package development tools such as `devtools`, `roxygen2`, and `testthat`. + - Contribution to the R ecosystem through the creation of new packages, improvement of existing packages, or participation in community discussions and collaborations. + +- **Objectives:** + - Develop and release high-quality R packages that provide valuable functionality to users across different domains. + - Ensure the reliability, efficiency, and usability of R packages through rigorous testing, documentation, and code review. + - Engage with the R community to gather feedback, address issues, and collaborate on package development efforts. + - Stay updated on emerging trends, best practices, and advancements in R programming and package development. + +## Getting Started + +Now that you understand the difference between an *R User ans R Developer*, a question arises: "How can one go from being a user to a developer?". + +The answer is simple, create something! In this case, create an R Package. + +Once you have accumulates more than 2-3 common functions that operate within the same context, that is a primary indicator that you should structure your project as an R Package. + +After you have more than one function it starts to get easy to lose track of what your functions do. Similarly, it can start to become difficult to track down, name, and organize the functions and you may be tempted to put all of the functions in one file and just source it. Instead, I propose the best solution is to create an R package. + +### What you Need + +To begin creating an R Package, you need: + +- [R](https://www.r-project.org/) and [RStudio](https://www.rstudio.com/) installed on your machine +- [Git](https://git-scm.com/) and [GitHub](https://github.com) +- Some initial R functions +- R Development Packages: + - `devtools` + - `usethis` + - `roxygen2` + - `pak` + - `knitr` and `rmarkdown` + +From there you can continue to naming your package, scaffolding out its structure, adding functions, documentation, metadata, data, license, vignettes, etc. + +## Pre-Requisite Resources + +To start, R package developers need to be familiar with the fundamentals of package development, and therefore should be familiar with some of the highest regarded resources available to read. + +Anyone who is serious about developing production grade R packages needs to be familiar with most of, if not all of the following resources and guides: + +

Table 1: R Package Developer Essentials

+ +| **Resource** | **Source** | +| --- | --- | +| [Writing R Extensions](http://cran.fhcrc.org/doc/manuals/R-exts.html) | [CRAN Manuals](http://cran.fhcrc.org/doc/manuals/R-exts.html) | +| [R Pac](http://cran.fhcrc.org/doc/manuals/R-exts.html)[kages](https://cran.r-project.org/manuals.html) | [H](https://cran.r-project.org/manuals.html)[ad](http://r-pkgs.had.co.nz/)[ley Wickham](http://cran.fhcrc.org/doc/manuals/R-exts.html) | +| [R](https://cran.r-project.org/manuals.html) [Package Pri](http://cran.fhcrc.org/doc/manuals/R-exts.html)[me](https://cran.r-project.org/manuals.html)[r](http://cran.fhcrc.org/doc/manuals/R-exts.html) | [Karl Br](http://cran.fhcrc.org/doc/manuals/R-exts.html)[oman](https://cran.r-project.org/manuals.html) | +| [Package Gu](http://cran.fhcrc.org/doc/manuals/R-exts.html)[idelines](https://cran.r-project.org/manuals.html) | [Biocondu](http://cran.fhcrc.org/doc/manuals/R-exts.html)[ctor](https://cran.r-project.org/manuals.html) | +| [rOpenSc](http://cran.fhcrc.org/doc/manuals/R-exts.html)[i Packages](https://cran.r-project.org/manuals.html) [Developer G](http://cran.fhcrc.org/doc/manuals/R-exts.html)[uide](https://cran.r-project.org/manuals.html) | [rOpenSci](http://cran.fhcrc.org/doc/manuals/R-exts.html) | + +
View Citations:

+(Wickham and Bryan, n.d.a, n.d.b; “Why Package and Environment Management Is Critical for Serious Data Science,” n.d.a, n.d.b; Vidoni, n.d.; Initiative, n.d.; “An Introduction to Packager,” n.d.; Gandrud 2015; Glennie 2020; “Owen-TheRGuide.pdf,” n.d.; Riederer, n.d.; Spector 2004; Team, n.d.; Zhu and Jianan, n.d.) +

+ +### Writing R Extensions Manual + +The [Writing R Extensions Manual](http://cran.fhcrc.org/doc/manuals/R-exts.html) is perhaps the most crucial resource listed above, and has even been considered the *Bible of R Package Development*. + +As Hadley puts it in his book [Writing R Packages](http://cran.fhcrc.org/doc/manuals/R-exts.html): + +> *"The best resource for the official details of package development is always the official writing R extensions manual. However, this manual can be hard to understand if you’re not already familiar with the basics of packages. It’s also exhaustive, covering every possible package component, rather than focusing on the most common and useful components, as this book does. Writing R extensions is a useful resource once you’ve mastered the basics and want to learn what’s going on under the hood.”* +> +> *— Hadley Wickham* + +Thanks to [Colin Fay](https://colinfay.me/), a more elegant version of the original manual has been created as a bookdown site and published online at . + +*Note: The other manuals listed on the [CRAN Manuals website](https://cran.r-project.org/manuals.html) contain a lot of hidden gems that are often overlooked by R developers. These resources contain some of the most crucial, foundational knowledge that anyone using R should eventually be made aware of, therefore I highly recommend you check those out in addition to Writing R Extensions*. + +### R Packages Book + +The "R Packages" (2nd Edition) Book outlines the importance of packages in R as the fundamental unit of shareable code, combining code, data, documentation, and tests. + +It highlights the vast array of over 19,000 packages on CRAN and encourages readers to develop their own packages for easier code sharing and organization. The book aims to automate package development as much as possible, utilizing the `devtools` and `usethis` packages and the RStudio IDE for a more efficient workflow. + +For a detailed overview, visit the [introduction page](https://r-pkgs.org/introduction.html). + +### R Package Primer + +The "R package primer" provides a minimal tutorial on creating R packages, emphasizing their simplicity and utility for code distribution and personal organization. The primer covers essential topics like package creation, documentation, and checking, alongside advanced topics like GitHub integration, CRAN submission, and writing vignettes. It advocates for package development as a practice for better code management and documentation, even for personal use. For more detailed guidance, visit [Karl Broman's R package primer](https://kbroman.org/pkg_primer/). + +### Bioconductor Package Guidelines + +The "Bioconductor Packages: Development, Maintenance, and Peer Review" guide offers comprehensive insights into the creation, upkeep, and review process of Bioconductor packages. Authored by Kevin Rue-Albrecht, Daniela Cassol, Johannes Rainer, and Lori Shepherd, it serves as an essential resource for developers within the Bioconductor project, promoting high-quality, well-documented, and interoperable software. Contributions to the guide are welcome via GitHub, indicating a collaborative and open-source approach to improving package development practices. For more details, visit the [Bioconductor contributions guide](https://contributions.bioconductor.org/index.html). + +### rOpenSci Packages Development Primer + +The "rOpenSci Packages: Development, Maintenance, and Peer Review" guide is a comprehensive resource designed for developers involved in the rOpenSci project. It covers a wide range of topics from package development, continuous integration, security best practices, to the software peer review process. It also includes guidance on package maintenance, collaboration, and marketing. Authored by the rOpenSci software review editorial team, it is an essential read for anyone looking to contribute to the rOpenSci ecosystem. For detailed information, visit the [rOpenSci Development Guide](https://devguide.ropensci.org/index.html). + +## R Packages + +Next, I will provide a comprehensive list of R Packages that aim to assist the development process. + +### Essentials + +> The following packages represent Core Development Libraries *and should generally be utilized in all scenarios of package development.* + +#### Devtools and Usethis + +**For automating the development workflow:** + +- [`devtools`](https://devtools.r-lib.org/) - The `devtools` package is a fundamental tool for R package development, providing functions for package creation, documentation, testing, and deployment. It streamlines the development process by automating common tasks like building, checking, and installing packages, making it an indispensable tool for R developers. +- [`usethis`](https://usethis.r-lib.org/) - The `usethis` package offers a collection of functions for automating package development workflows, including project setup, file creation, and version control integration. It simplifies common tasks like creating package directories, adding functions, and managing dependencies, enhancing productivity and efficiency for R developers. + +#### Documentation + +**For generating manual pages and documentation:** + +- `roxygen2` - The `roxygen2` package simplifies the process of documenting R code by generating Roxygen-style comments from function definitions. It enables developers to create consistent, well-formatted documentation for their packages, enhancing readability and maintainability. By automating the documentation process, `roxygen2` ensures that package documentation stays up-to-date with code changes, facilitating collaboration and code sharing. +- `knitr` & `rmarkdown` - The `knitr` and `rmarkdown` packages provide tools for creating dynamic reports, presentations, and documentation in R. They enable developers to embed R code, plots, and text in a single document, facilitating reproducible research and effective communication of results. By combining code and narrative in a single document, `knitr` and `rmarkdown` enhance the clarity and transparency of package documentation, making it easier for users to understand and utilize the package. + +#### Testing + +**For testing:** + +- `testthat` - The `testthat` package is a unit testing framework for R that enables developers to write and run tests for their code. It provides functions for defining test cases, running tests, and reporting results, ensuring that packages behave as expected across different scenarios. By incorporating test-driven development practices, `testthat` helps developers identify and fix bugs early in the development process, improving code quality and reliability. + +- `tinytest` - The `tinytest` package is a lightweight testing framework for R that simplifies the process of writing and running tests. It offers a simple and intuitive interface for defining test cases, running tests, and reporting results, making it easy for developers to validate their code and ensure its correctness. By providing a minimalistic testing solution, `tinytest` streamlines the testing process and enhances the quality and robustness of R packages. + +- `shinytest2` - The `shinytest2` package is a testing framework for Shiny applications that enables developers to automate the testing of interactive web applications. It provides functions for recording and replaying user interactions, capturing screenshots, and comparing outputs, ensuring that Shiny apps behave as expected across different environments. By automating the testing process, `shinytest2` helps developers identify and fix issues in their Shiny apps, improving user experience and reliability. + + +#### Dependency Management + +**For managing package dependencies:** + +- `pak` - The `pak` package is a lightweight dependency management tool for R that simplifies the installation and management of package dependencies. It provides functions for installing, updating, and removing packages, ensuring that packages are installed from reliable sources and compatible with the current R environment. By automating dependency management tasks, `pak` streamlines the package development process, reducing the risk of conflicts and errors. +- `remotes` - The `remotes` package offers functions for installing packages from remote repositories like GitHub, GitLab, and Bitbucket. It enables developers to install packages directly from source control repositories, facilitating collaboration and sharing of packages across different platforms. By providing a flexible and extensible interface for package installation, `remotes` enhances the accessibility and availability of R packages for developers and users. +- `renv` - The `renv` package is a dependency management tool for R that creates isolated project environments with specific package versions. It enables developers to capture and manage package dependencies within a project, ensuring reproducibility and consistency across different environments. By creating project-specific package libraries, `renv` helps developers avoid conflicts and ensure that packages are installed and loaded correctly, enhancing the reliability and portability of R projects. + +### Useful Common Libraries + +- `available` - Check if a package is available on CRAN +- `lifecycle` - represent package and function development lifecycle stages +- `desc` - Manage and edit the package's `DESCRIPTION` +- `pkgdown` - Generate package documentation static site +- `testdown` - Generate test reports +- `gitdown` - Generate git commit messages + +### Roxygen Tools + +- `roxygen2md` +- `roxyglobals` +- `rd2list` +- `Rd2roxygen` +- `rd2markdown` +- `roxygen2comment` + +### Dependency Tools + +- `attachment` - Attach and detach packages +- `automagic` - Automatically install and load packages +- `CodeDepends` - Identify dependencies between functions +- `dep` - Dependency management +- `sysreqs` - Identify system requirements for R packages +- `pkgnet` - Visualize package dependencies +- `functiondepends` - Identify dependencies between functions + +### Git and GitHub + +- `gert` - Git tools +- `gitdown` - Generate git reports +- `git2r` - Git interface +- `gh` - GitHub interface +- `git4r` - Git interface +- `gitGPT` - Git interface with GPT-3 +- `precommit` - Pre-commit hooks + +### Configuration + +- `config` - Configuration management +- `options` - Set and get options + +### Credentials & Secrets + +- `keyring` - Securely store and retrieve credentials +- `credentials` - Securely store and retrieve credentials +- `gitcreds` - Securely store and retrieve git credentials +- `ssh` - SSH interface +- `askpass` - Prompt for passwords + +plus, base R's `Sys.genenv()` and `Sys.setenv()`. + +### Fundamental Low-Level Packages + +> These packages are not necessarily called directly but are built on top of as dependencies to higher level libraries (i.e. `usethis`, `devtools`, etc.) + +- `pkgload` - Load packages +- `pkgbuild` - Build packages +- `pkgdepends` - Manage package dependencies +- `pkgapi` - Manage package API +- `pkgcache` - Manage package cache +- `pkgnet` - Visualize package dependencies + +### Linting & Styling + +- `goodpractice` - Check package quality +- `lintr` - Lint R code +- `styler` - Style R code +- `formatR` - Format R code +- `stylermd` - Style R Markdown +- `spelling` - Spell check R code +- `roxylint` - Lint Roxygen comments +- `cleanr` - Clean R code +- `janitor` - Clean R Dataframe +- `sanitizers` - Sanitize R code +- `refactor` - Refactor R code + +### Package Documentation + +- `docthis` - Document R objects +- `prettydoc` - Custom RMardown templates +- `quarto` - New RMarkdown'ish package +- `pkgdown` - Generate package documentation +- `testdown` - Generate test reports +- `autodoc` - Automatically document R objects +- `papillon` - Create internal functions for launching documentation +- `fusen` - RMarkdown driven package development +- `badger` - Generate badges for R packages +- `badgen` - Generate badges for R packages +- `bookdown` - Generate books from RMarkdown +- `bookdownplus` - Generate books from RMarkdown +- `altdoc` - Generate alternative documentation +- `fledge` - Automate `NEWS.md` +- `newsmd` - Automate `NEWS.md` +- `autonewsmd` - Automate `NEWS.md` +- `docreview` - Review documentation +- `covrpage` - Generate coverage reports + +### Metadata + +- `codemeta` - Generate CodeMeta metadata +- `codemetar` - Generate CodeMeta metadata +- `pkgstats` - Generate package statistics +- `sessioninfo` - Generate session information + +### Checks & Tests + +- `rcmdcheck` - `R CMD CHECK` runner +- `testdat` - Generate test data +- `validate` - Validation and Data Quality +- `realtest` - Real world testing +- `roxytest` - Test Roxygen comments +- `checkhelper` - Helper functions for `R CMD CHECK` +- `codetools` - Code analysis tools +- `checkglobals` - Check global variables +- `rhub` - Check R packages on various platforms + +### Validation and Assertions + +- `assertthat` - Assertions +- `checkmate` - Assertions +- `assertive` - Assertions +- `assertthat` - Assertions +- `assert` - Assertions +- `pointblank` - Validation + +### Utilities + +- `fs` - File system interface +- `purrr` - Functional programming +- `dplyr` - Data manipulation +- `tidyr` - Data manipulation +- `stringr` - String manipulation +- `lubridate` - Date manipulation + +- `DBI` - Database interface +- `dbx` - Database interface +- `RPostgres` - DBI compliant interface for PostgreSQL +- `dbplyr` - Database interface with `dplyr` +- `connections` - Database connections +- `pool` - Database connection pooling + +- `dm` - Data Modeling +- `datamodelr` - Data Modeling + +- `plumber` - API development + +- `cli` - Command line interface + +- `logger` - Logging + +- `snakecase` - Convert snake case + +- `prefixer` - Add prefixes to functions +- `addinit` - Add script headers + +- `shiny` - Shiny apps +- `htmltools` - HTML tools +- `shinyjs` - Shiny JavaScript +- `golem` - Shiny app development +- `packer` - Package JavaScript with R code + +- `roger` - R Markdown driven package development +- `patrick` - Automate package development + +- `cachem` - Caching +- `memoise` - Caching +- `qs` - Quick serialization for caching +- `digest` - Hashing + +- `R6` - Object oriented programming + +- `cranlogs` - CRAN download logs +- `dlstats` - CRAN download logs + +- `oysteR` - RStudio addin +- `foghorn` - RStudio addin + +- `actions` - GitHub actions +- `rworkflows` - R Workflows +- `tic` - timing +- `tictoc` - timing + +- `gpg` - GPG interface + +- `debugr` - Debugging + +- `valtools` - Validation tools + +- `pkgcond` - Package conditions + +- `riskmetric` - Risk metrics + +- `represtools` - Reproducible research tools + +- `containerit` - Containerize R code +- `dockerfiler` - Dockerfile generator + + +- `onetime` - One time code execution + +- `gitignore` - Generate `.gitignore` files + + +- `whoami` - User information + +- `rprojroot` - Project root +- `here` - Project root + +- `whisker` - Templating + +- `magick` - Image processing + +- `waldo` - Low-Level R Objects +- `vctrs` - Vector manipulation + +- `conflicted` - Conflict resolution + +- `webfakes` - Web scraping + +- `ps` - Process management +- `processx` - Process management +- `callr` - Process management +- `withr` - Process management + +- `evaluate` - Evaluate R code + +- `systemfonts` - System fonts + +- `later` - Future +- `future` - Future +- `promises` - Promise + +- `pillar` - Tidy printing +- `pretyunits` - Pretty units +- `progress` - Progress bars + + +- `bench` - Benchmarking +- `profvis` - Profiling + +- `ymlthis` - YAML + +- `piggyback` - Data sharing + +- `itdepends` - Dependency management +- `dependencies` - Dependency management + +- `ellipsis` - Ellipsis (`...`) + +- `miniUI` - Shiny UI + +- `rversions` - R versions + +- `pingr` - Ping URLs + +- `rcompendium` - Research Compendium + +- `litr` - Literate programming + +- `leprechaun` +- `pkgverse` +- `metamakr` + + +## Summary + +1. Understanding the Basics: Before delving into the intricacies of package development, it's crucial to grasp the fundamental concepts of R programming. Resources like "R for Data Science" by Hadley Wickham and Garrett Grolemund serve as an excellent starting point for beginners, providing a comprehensive overview of R programming essentials and data manipulation techniques. + +2. Mastering Package Development: Once you've familiarized yourself with the basics, it's time to dive into the world of package development. The "R Packages" book by Hadley Wickham is the go-to resource for understanding the principles of package structure, documentation, and best practices. Additionally, online tutorials from platforms like DataCamp and RStudio provide hands-on guidance for creating your first R package from scratch. + +3. Harnessing the Power of Version Control: Effective version control is essential for managing the development and collaboration of R packages. Platforms like GitHub offer robust version control capabilities, allowing developers to track changes, collaborate with peers, and maintain a history of their package development journey. Resources such as "Happy Git and GitHub for the useR" by Jenny Bryan provide comprehensive guides to mastering Git and GitHub workflows tailored specifically for R users. + +4. Engaging with the Community: The R community is a vibrant ecosystem bustling with passionate developers, users, and enthusiasts. Engaging with online communities such as Stack Overflow, RStudio Community, and the R4DS Slack channel enables you to seek guidance, share insights, and collaborate with fellow developers. Conferences like useR! and rstudio::conf provide opportunities to connect with experts, attend workshops, and stay updated on the latest trends in R package development. + +5. Streamlining Development with Tools and Packages: As you progress on your journey, leveraging tools and packages designed for R package development can significantly enhance your productivity and efficiency. Tools like devtools, roxygen2, and testthat streamline package development tasks such as building, documenting, and testing your code. Additionally, exploring specialized packages like usethis and pkgdown empowers you to automate common development workflows and create polished package documentation and websites with ease. + +## Schedule with Us + +%%[scheduler] \ No newline at end of file