Conditional Flow in R
Decision making/Conditional control Flow  
As other languages R also support conditional flow for
the control which can be controlled using if, ifelse or switch commands 
Syntax
If()
ElseIf()
Ifelse()
In the case of numeric vector, zero is taken as FALSE,
rest as TRUE
Benefits/Usages 
 Dynamic content rendered on separate page 
Code cleanliness more manageable, 
Master / child page structure can be achieved
Code Snippet 
          #If
y<-10
if(y==10)
{
 print("This is true")
}
#If..else
if (y<10)
 {
 print("Less than 10")
} else 
{
 
print("Greter than or equals to 10")
}
#Nested if else……
z <- 1
if (z < 0) {
  
print("-ive number")
} else if (z > 0) {
  
print("+ive number")
} else
  
print("Zero")
Conditional Flow in R
![]() Reviewed by Rupesh
        on 
        
11:23
 
        Rating:
 
        Reviewed by Rupesh
        on 
        
11:23
 
        Rating: 
       
No comments: