You're asked to create a numeric variable in R and perform some basic arithmetic operations on it. How would you do it?

  • Use <- to assign a numeric value and use +, -, *, / for arithmetic operations
  • Use <- to assign a numeric value and use functions like sum(), diff(), prod(), div() for arithmetic operations
  • Use = to assign a numeric value and use +, -, *, / for arithmetic operations
  • Use = to assign a numeric value and use functions like sum(), diff(), prod(), div() for arithmetic operations
In R, we use the <- operator to assign values to variables. The basic arithmetic operations are performed using the +, -, *, and / operators. For example, x <- 5; x + 2 would assign 5 to x and then add 2.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *