Title: R - Decision making
1R - Decision making
Swipe
2R - Decision making
Decision making structures require the
programmer to specify one or more conditions to
be evaluated or tested by the program. Along
with a statement or statements to be executed if
the condition is determined to be true, and
optionally, other statements to be executed if
the condition is determined to be
false. Following is the general form of a
typical decision making structure found in most
of the programming languages
3Condition
If condition true
If condition false
Conditional code
4Statement Description
R provides the following types of decision making
statements. if statement An if statement
consists of a Boolean expression followed by one
or more statements. if.else statement An if
statement can be followed by an optional else
statement, which executes when the Boolean
expression is false. switch statement A switch
statement allows a variable to be tested for
equality against a list of values.
5Types of Decision Trees
- Regression Trees
- Classification Trees Classification Error Rate
Gini Index - Cross-Entropy
- Advantages and Disadvantages of Decision Trees
6Decision Making Statement in R
The decision making statement in R are as
followed if statement if-else statement
if-else-if ladder nested if-else statement
switch statement
7Topics for next Post
R - Loops R - Strings R - Factors Stay Tuned
with