Developing R Packages
Create and share your own R Packages!
Start Course for Free4 Hours16 Videos56 Exercises6,801 Learners
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Loved by learners at thousands of companies
Course Description
In this course, you will learn the end-to-end process for creating an R package from scratch. You will start off by creating the basic structure for your package, and adding in important details like functions and metadata. Once the basic components of your package are in place, you will learn about how to document your package, and why this is important for creating quality packages that other people - as well as your future self - can use with ease. Once you have created the components of your package, you will learn how to test they work properly, by creating tests, running checks, and building your package. By the end of this course you can expect to have all the necessary skills to create and share your own R packages.
- 1
The R Package Structure
FreeIn this chapter, you will learn the basics of creating an R package. You will learn about the structure of R packages, set up a package, and write a function and include it in your package. You will also learn about the metadata stored in the DESCRIPTION and NAMESPACE files.
Introduction to package building50 xpThe structure of an R package100 xpContents of an R package50 xpWriting a simple function100 xpIncluding functions in a package100 xpDESCRIPTION and NAMESPACE files50 xpPackage names50 xpWriting a DESCRIPTION file50 xpDetailing authors, maintainers and contributors50 xpOptional directories50 xpThe use_* functions100 xpBest practice for structuring code100 xp - 2
Documenting Packages
In this chapter, you will learn how to document your package. You will learn why documentation is important, and how to provide documentation for your package, its functions, and other components. You will also learn about what it means to export a function and how to implement this in your package.
Introduction to roxygen250 xpA simple function header100 xpDocumenting function arguments100 xpImporting other packages100 xpHow to export functions?50 xpExport best practice50 xpExporting functions100 xpDocumenting other elements50 xpAdding examples100 xpDocumenting function return values100 xpAdditional documentation100 xpMinimum level of documentation50 xpDocumenting a package50 xpAdding package documentation100 xpDocumenting data objects100 xpCreating man files100 xp - 3
Checking and Building R Packages
In this chapter, you will learn about how to run checks to ensure that your R package is correctly structured and can be installed. You will learn how to correct common problems, and get your package ready to be built so it can be shared with others.
Why check an R package?50 xpWhat does a "check" check?50 xpRunning a check100 xpErrors, warnings and notes50 xpUndocumented parameters100 xpUndefined global variables100 xpDifferences in package dependencies50 xpDepends or imports?50 xpAdding a dependency50 xpAdding the import to the description100 xpBuilding packages with continuous integration50 xpBuilding an R package100 xpSetting a package up for using Travis50 xp - 4
Adding Unit Tests to R Packages
In the final chapter, you will learn how to add tests to your package to ensure your code runs as expected if the package is updated or changes. You will look at how to test functions to ensure they produce expected values, and also how to test for other aspects of functionality such as expected errors. Once you've written tests for your functions, you'll finally learn how to run your tests and what to do in the case of a failing test.
What are unit tests and why write them?50 xpSetting up the test structure100 xpWriting an individual test100 xpTesting for equality100 xpTesting errors and warnings50 xpTesting errors100 xpTesting warnings100 xpTesting specific output and non-exported functions50 xpTesting non-exported functions100 xpTesting specific output50 xpGrouping tests and execution output50 xpGrouping tests100 xpExecuting unit tests100 xpUnderstanding a test failure50 xpWrap-up50 xp
In the following tracks
R ProgrammerCollaborators



Prerequisites
Introduction to Writing Functions in RAimee Gott
See MoreHead of Skill Assessment Content at DataCamp
Aimee is the Head of Certification Content at DataCamp. Prior to joining DataCamp she was the Education Practice Lead at Mango Solutions. Aimee is a co-author of SAMS Teach Yourself R in 24 Hours.
What do other learners have to say?
FAQs
Join over 11 million learners and start Developing R Packages today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.