daniel daniel - 1 year ago 149
R Question

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


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?

Answer Source

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) )
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download