Skip to main content

Chapter 4: Control Structures

  • Chapter
  • 6828 Accesses

Abstract

In Chapter 3, you saw an example of a simple function for calculating a person’s body mass index (BMI). The function used logic to determine the person’s risk category. The use of logic, conditional statements, and loops are all inherent in controlling the flow of a program. Although there are many different ways to write conditional statements, and loops, too, for that matter, they all boil down to testing to see if some condition is true or false and then behaving accordingly. A program is nothing more or less than a series of instructions telling a computer what to do. As I have mentioned, R is both functional and objected-oriented, so every R program consists of function calls that operate on objects.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   79.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Dr. Joshua F. Wiley and the estate of Larry A. Pace

About this chapter

Cite this chapter

Wiley, J.F., Pace, L.A. (2015). Chapter 4: Control Structures. In: Beginning R. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0373-6_4

Download citation

Publish with us

Policies and ethics