OneBite.Dev - Coding blog in a bite size

create a variable in R

Code snippet on how to create a variable in R

  my_variable <- 10

This code creates a new variable called “my_variable” and assigns it the value of 10. In R, the arrow operator (<-) is used for assignment. On the left side of the arrow operator is the name of the variable (in this case “my_variable”), and on the right is the value that the variable is assigned (in this case, 10). The result is that the variable “my_variable” now holds the value 10 and can be used in other calculations or assignments.

r