How to create a constant inside R package? How to create a constant inside R package? r r

How to create a constant inside R package?


The simplest and cleanest way would be to create a function, e.g.

K_Q3 <- function() { qnorm(1 - 0.01/2) }

Note that calling functions in R has a non-negligible overhead.You should avoid calling it in loops, or copy it to a local variable before.


Just like you create function objects for your package by placing a .R file that defines them in the "R" folder within your package directory. You can simply assign a numeric value 2.575829 to a variable name--just don't export it.