Abstract
While scripts are just listings of code stored outside of R, functions are objects of the function mode and are stored in the workspace. Most functions require specific kinds of arguments, which must be input into the function correctly. For example, if a function calls for a matrix and a data frame is input, the function will return an error. Since external tables are often read into the R workspace as data frames, using a data frame for a matrix is quite a common error. This chapter covers an example of using a script to do a simple mining of Twitter tweets, as well as how to call a function, use arguments in a function, and access the output of a function.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature
About this chapter
Cite this chapter
Tollefson, M. (2022). How to Use a Script or Function. In: R 4 Quick Syntax Reference. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-7924-3_8
Download citation
DOI: https://doi.org/10.1007/978-1-4842-7924-3_8
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-7923-6
Online ISBN: 978-1-4842-7924-3
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)