'R CMD CHECK "Found the following assignments to the global environment:" [closed]
Running R CMD check
on my package I'm receiving the following warning message:
Found the following assignments to the global environment:
File ‘SciencesPo/R/describe.R’:
assign(as.character(substitute(data)), dataset, pos = 1)
I tried to silence it by adding an environment as mentioned here using envir = .SciencesPoEnv
, and envir = .GlobalEnv
, but received the same message.
Does anyone have a clue how can I fix it?
Solution 1:[1]
This should do:
#' 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) )
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | petermeissner |