OneBite.Dev - Coding blog in a bite size

declare a global variable in R

Code snippet on how to declare a global variable in R

 x <<- 5

This declares a global variable x with the value 5.

In R, a global variable can be declared by using the <<- operator instead of the <- operator when assigning a value to a variable. The <<- operator assigns a value to a variable in the global environment, regardless of the current scop

r