Abstract
R provides users the ability to write, save, and reuse functions. These functions are flexible and extend the power of R for users who need specialized capabilities not provided by the functions in base R or in contributed packages. Users are advised, however, to check CRAN (the Comprehensive R Archive Network) before they write a function, as it is very likely that someone else has encountered the same problem previously, and has already written the desired function for you. A case in point is the z test function we wrote in Recipe 10-1. As it materializes, the BSDA package already has a function labeled z.test that accomplishes the purpose we needed, and which also provides more options, including two-sample tests and directional and nondirectional alternative hypotheses.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsAuthor information
Authors and Affiliations
Rights and permissions
Copyright information
© 2014 Larry A. Pace
About this chapter
Cite this chapter
Pace, L.A. (2014). Writing Reusable Functions. In: R Recipes. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0130-5_13
Download citation
DOI: https://doi.org/10.1007/978-1-4842-0130-5_13
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-0131-2
Online ISBN: 978-1-4842-0130-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)