Control Statements in R: For Loop, If, Else: Beginning R Programming – Part 10

Control statements allow us to control the flow of a program. We make use of the for loop, if and else statement to loop through data values, check if they meet a condition, and assign a string text label to each value. Learn these simple yet useful control statements – the for loop statement, and the if and else statements.

Prerequisites:
Data Set
How to Install R

Part 11: 
How to Write a Function in R

Part 9: 
Calling Pre-built Functions in R

Full Series:
Beginning R Programming

More Data Science Material:
[Video] Classification Models in Minutes
[Blog] Getting Started with Kaggle Competitions

 

(27)

Rebecca Merrett
About The Author
- Rebecca holds a bachelor’s degree of information and media from the University of Technology Sydney and a post graduate diploma in mathematics and statistics from the University of Southern Queensland. She has a background in technical writing for games dev and has written for tech publications.

Avatar

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>