R package. Can I use global variables in a package?

I am making a package on R. I have two functions sharing a variable (global).

How to import it into a package?

For instance,

m<-0
f<-function() { m <- m+1 }
g<-function() { m <- m-1 }
+3
source share
1 answer

Yes, and you can export the variable, but you do not need to.

The topic you want to find is “Data in Packages” in the “Writing Extensions” guide.

+3
source

All Articles