12EXCEPTIONS, TIMINGS, AND VISIBILITY

image

Now that you’ve seen how to write your own functions in R, let’s examine some common function augmentations and behaviors. In this chapter, you’ll learn how to make your functions throw an error or warning when they receive unexpected input. You’ll also see some simple ways to measure completion time and check progress for computationally expensive functions. Finally, you’ll see how R masks functions when two have the same name but reside in different packages.

12.1 Exception Handling

When there’s an unexpected problem during execution of a function, R will notify you with either a warning or an error. In ...

Get The Book of R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.