Loved by learners at thousands of companies
The expansive ecosystem of R packages may seem daunting at first glance, but don't worry! Acquiring the skill to develop your own R package is invaluable, regardless of whether you collaborate on your code with others. With a range of modern tools and packages at your fingertips, it's simpler than ever.
Discover the Benefits of Package CreationCreating a package allows you to document your functions, enhancing their quality. It provides a formal structure for your code and analyses, enabling function improvement while tests verify no previous functionality is disrupted.
Practice Using R Package Development ToolsThis course will guide you through these concepts, and as a bonus, you'll develop your own package focused on unit conversion. You'll learn how to use the devtools, usethis, roxygen2, available, and testthat packages as well as rmarkdown to speed up and improve your package development workflow.
Experience the Power of R Package DevelopmentGet ready to dive into the dynamic world of R package development and empower yourself with a valuable toolset that can greatly enhance your data analysis journey!
Creating R Packages: From Data to FunctionsFree
Dive into the essentials of R package construction, from understanding the architecture, the critical R and man directories, to the significance of the DESCRIPTION and NAMESPACE files. Get hands-on with the usethis package as you create your own package skeleton and include data. Strengthen your R function writing skills, grasp best practices for package development, and get comfortable saving functions to a file. Finally, install your package locally using devtools.Components of an R package50 xpR package truths50 xpWhat's needed in all R packages?100 xpRequired package components100 xpData and R Markdown template in an R package50 xpCreate an R package100 xpAdd data to the R package100 xpCreate an R package R Markdown template file100 xpR Markdown template file layout100 xpBuilding package functions50 xpR function for converting distances100 xpInstall the R package and try it out100 xp
Designing R Packages: Package Naming and Dependencies
Learn the advantages of creating packages versus using scripts, exploring the impact on code organization, reproducibility, collaboration, and sharing. Discover effective strategies for structuring code and functions within the R directory, and choosing an appropriate name and license for your package. Finally, you’ll learn how to manage CRAN package dependencies.More package structure50 xpComparing packages and scripts50 xpChecking your package name100 xpChoosing an appropriate license for your package100 xpPackage build50 xpAdding and testing a new function in the package100 xpDebug errors with load_all()100 xpDifferences between check() errors, warnings, and notes50 xpPackage dependencies50 xpTypes of R package dependencies100 xpSet package dependencies100 xpSet more package dependencies100 xp
Package Documentation: Generating Help Files and Vignettes
Harness the power of examples in documentation by creating function examples with roxygen2. Understand the significance of examples in clarifying function behavior and identifying key components of a well-documented R function. Explore the purpose of vignettes in R package documentation and learn best practices for creating engaging vignettes and evaluating their content and quality through metadata analysis.Help files with R packages50 xpOrder of help file components100 xpExported and non-exported functions100 xpDocumentation with roxygen250 xpFunction documentation starters100 xpFunction argument documentation100 xpFunction returns and exporting100 xpGenerate help file documentation100 xpGetting started with R package vignettes50 xpBrowse package vignette100 xpProperties of vignettes and articles50 xpDesigning R package vignettes50 xpGenerate an R package vignette skeleton100 xpDesign an R package vignette100 xpBuild package vignettes100 xp
Testing R Packages: Using Unit Tests and Robust Checks
Identify why the unit tests are important to package development and maintenance and learn how to implement the testthat package for unit tests. Convert R examples into expectations to build your unit test knowledge. You’ll then gain an understanding on how to document your package data and run some final checks to ensure you have developed a robust R package.Unit tests50 xpAdvantages of unit testing50 xpSet up your package for testing100 xpCreate a testing file100 xpExploring expect statements50 xpConvert an example into a test100 xpCheck for warnings and errors100 xpCheck for output and identicalness50 xpStoring expectations as unit tests and running tests50 xpFix expectation errors100 xpRun a test on function examples100 xpRun all tests in the package100 xpFinal steps50 xpFinalize your DESCRIPTION file100 xpDocument your data100 xpCheck your R package100 xpCongratulations!50 xp
PrerequisitesIntroduction to Writing Functions in R
Jasmin LudolfSee More
Data Science Content Developer, DataCamp
Jasmin is a Content Developer at DataCamp. After ten years as a global marketing manager in the music industry, she recently changed careers to follow her curiosity for data. Her passion is value exchange and making data science accessible to all.