- 已编辑
我在R/globalconstants.R
中定义了全局变量
cat R/globalconstants.R
GC1 <- 1
在其他R函数中如:R/myfun.R
中引用全局常量GC1
cat R/myfun.R
myfun <- function(gc1 = GC1) { return(gc1) }
但在R包检查时报错:
Error in GC1 :
object 'GC1' not found
请教如何在R包中定义常量
我在R/globalconstants.R
中定义了全局变量
cat R/globalconstants.R
GC1 <- 1
在其他R函数中如:R/myfun.R
中引用全局常量GC1
cat R/myfun.R
myfun <- function(gc1 = GC1) { return(gc1) }
但在R包检查时报错:
Error in GC1 :
object 'GC1' not found
请教如何在R包中定义常量