Intermediate R programming | Datacamp- Intermediate R programming | R programming for data scientist | programming language for Data Scientist
Intermediate R programming from Datacamp In this chapter, we will learn about conditional statements, loops, and functions to power the R scripts. Conditional and control flow # Equality: # Comparison of logicals TRUE == FALSE # Comparison of numerics -6 * 14 != 17 - 101 # Comparison of character strings "useR" == "user" # Compare a logical with a numeric TRUE == 1 [1] TRUE # Greater and less than: # Comparison of numerics -6 * 5 + 2 >= -10 + 1 # Comparison of character strings "raining" <= "raining dogs" # Comparison of logicals TRUE > FALSE [1] TRUE # Compare vectors: # The linkedin and facebook vectors have already been created for you linkedin <- c ( 16 , 9 , 13 , 5 , 2 , 17 , 14 ) facebook <- c ( 17 , 7 , 5 , 16 , 8 , 13 , 14 ) # Popular days linkedin > 15 # Quiet days linkedin <= 5 # LinkedIn more popular than Facebook linkedin > facebook [1] FALSE TRUE TRUE FALSE FAL
Comments
Post a Comment