Abstract
Flow control statements are used to repeat a series of tasks a number of times or to direct flow based on a logical object. For persons who came into programming in the age of FORTRAN and BASIC, using loops is very comfortable. (In looping, either an index is used to apply a group of expressions to each element of an object or a group of expressions is repeated until a condition is met.) In R, the better choice, if possible, is to select multiple indices of an object(s) (for an object(s) with dimensions) and to operate of the selection, instead of looping through each individual index. For many of the tasks that can be done by flow control statements, using indices is faster than looping.
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). Flow Control. In: R 4 Quick Syntax Reference. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-7924-3_12
Download citation
DOI: https://doi.org/10.1007/978-1-4842-7924-3_12
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)