Skip to Content
R: Unleash Machine Learning Techniques
book

R: Unleash Machine Learning Techniques

by Raghav Bali, Dipanjan Sarkar, Brett Lantz, Cory Lesmeister
October 2016
Beginner to intermediate
1123 pages
26h 44m
English
Packt Publishing
Content preview from R: Unleash Machine Learning Techniques

Controlling code flow

This section covers areas related to controlling the execution of your code. Using specific constructs such as if-else and switch, you can execute code conditionally. Constructs like for, while, and repeat, and help in executing the same code multiple times which is also known as looping. We will be exploring all these constructs in the following section.

Working with if, if-else, and ifelse

There are several constructs which help us in executing code conditionally. This is especially useful when we don't want to execute a bunch of statements one after the other sequentially but execute the code only when it meets or does not meet specific conditions. The following examples illustrate the same:

> num = 5
> if (num == 5){
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Semi-Supervised and Unsupervised Machine Learning: Novel Strategies

Semi-Supervised and Unsupervised Machine Learning: Novel Strategies

Amparo Albalate, Wolfgang Minker
Strategies in Biomedical Data Science

Strategies in Biomedical Data Science

Jay A. Etchings, Ken Buetow

Publisher Resources

ISBN: 9781787127340Purchase Link