R 命令检查 "Found the following assignments to the global environment:"

R CMD CHECK "Found the following assignments to the global environment:"

运行 R CMD check 在我的包裹上,我收到以下警告消息:

Found the following assignments to the global environment:
File ‘SciencesPo/R/describe.R’:
  assign(as.character(substitute(data)), dataset, pos = 1)

我试图通过使用 envir = .SciencesPoEnvenvir = .GlobalEnv 添加提到的 here 环境来使其静音,但收到了相同的消息。

有人知道我该如何解决吗?

应该这样做:

#' function loading results in global environment
#' @param pos defaults to 1 which equals an assingment to global environment
assign_to_global <- function(pos=1){
  assign("sentence", "That was easy.", envir=as.environment(pos) )
}