Skip to main content

Examples of Flow Control

  • Chapter
  • First Online:
R Quick Syntax Reference
  • 1343 Accesses

Abstract

This chapter gives some examples of flow control as well as ways to do the examples using indexing. The first example uses nested for loops and if/else statements. The second example uses the while statement. The third example is of nested for loops. The fourth example uses a for loop, an if statement, and a next statement. The fifth example is of a for loop, a repeat loop, an if statement, and a break statement.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Margot Tollefson

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Tollefson, M. (2019). Examples of Flow Control. In: R Quick Syntax Reference. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4405-0_13

Download citation

Publish with us

Policies and ethics