Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering RStudio: Develop, Communicate, and Collaborate with R

You're reading from   Mastering RStudio: Develop, Communicate, and Collaborate with R Harness the power of RStudio to create web applications, R packages, markdown reports and pretty data visualizations

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher Packt
ISBN-13 9781783982547
Length 348 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. The RStudio IDE – an Overview FREE CHAPTER 2. Communicating Your Work with R Markdown 3. R Lesson I – Graphics System 4. Shiny – a Web-app Framework for R 5. Interactive Documents with R Markdown 6. Creating Professional Dashboards with R and Shiny 7. Package Development in RStudio 8. Collaborating with Git and GitHub 9. R for your Organization – Managing the RStudio Server 10. Extending RStudio and Your Knowledge of R Index

Testing a package


When we build a package, it is very important to test it. Packages can get very complex structures and this creates a high potential for bugs. The most basic way to test your package is to build and load it again and again and test all its functions simply by using them. But this only works up to a certain package size. If our package gets too big, we cannot test every single function after every change we made to the package.

The better way to test our packages when they reach a certain size is the testthat package, created by Hadley Wickham, who also created the devtools package. This package is available on CRAN, so we can simply install it with the install.packages() function.

Using testthat in a package

Before we can use testthat in your project, we have to call the use_testthat() function from the devtools package once. This function will set up all folders and dependencies and create the tests folder.

This folder includes a testthat.R file and the testthat folder, which...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime