An introduction to R from Datacamp In this chapter, we will learn about the basics and widely used data structures in R like vectors, factors, lists, and data frames. Arithmetic operations: # An addition 5 + 5 [1] 10 # A subtraction 5 - 5 [1] 0 # A multiplication 3 * 5 [1] 15 # A division ( 5 + 5 ) / 2 [1] 5 # Exponentiation 2 ^ 5 [1] 32 # Modulo 28 %% 6 [1] 4 Variable Assignment: # Assign a value to the variable my_apples my_apples <- 5 # Fix the assignment of my_oranges my_oranges <- 6 # Create the variable my_fruit and print it out my_fruit <- my_apples + my_oranges my_fruit [1] 11 Basic data types in R: # Declare variables of diffe...
Comments
Post a Comment