OneBite.Dev - Coding blog in a bite size

add two numbers in R

Code snippet on how to add two numbers in R

  x <- 7
  y <- 5
  sum <- x + y
  print(sum)

This code adds two numbers together and returns the sum. First, two variables - “x” and “y” - are created, each declared with an integer value of 7 and 5, respectively. Then, using the ”+” operator, these numbers are added and the result is stored in a new variable called “sum”. Finally, the “print” function is used to output the value of “sum” to the console.

r