A Data Scientist's Guide to Acquiring, Cleaning, and Managing Data in R by Samuel E. Buttrey & Lyn R. Whitaker

A Data Scientist's Guide to Acquiring, Cleaning, and Managing Data in R by Samuel E. Buttrey & Lyn R. Whitaker

Author:Samuel E. Buttrey & Lyn R. Whitaker
Language: eng
Format: epub
ISBN: 9781119080060
Publisher: Wiley
Published: 2017-09-28T00:00:00+00:00


5.1.1 Function Arguments

An argument is a value passed to a function. The aforementioned funk function has two arguments named x and y. R functions may have as many arguments as needed (or none at all). Arguments may be vectors or data frames or lists or functions or any other R object. This means that if you develop a function, particularly for other users, the first thing it should do is to ensure that the arguments are of the types expected by the user. For example, the funk function checks to see that the argument x is a non-negative number. But what happens if the user passes a data frame or a character string or a list? The function developer needs to detect these unexpected inputs and stop gracefully. We discuss error handling in Section 5.3.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.