Re: [R-pkg-devel] Assignments to the global environment and use of on.exit

2021-06-25 Thread Siddhanta Phuyal
Hello, Thank You. It worked. The package has been submitted to CRAN. Thank You for your helpful feedback. On Tue, Jun 22, 2021 at 10:00 PM Oliver Madsen wrote: > The problem is solved by either > > 1) creating an environment variable within the package namespace (as you > would a function) usin

Re: [R-pkg-devel] Assignments to the global environment and use of on.exit

2021-06-22 Thread Oliver Madsen
The problem is solved by either 1) creating an environment variable within the package namespace (as you would a function) using new.env(). This can then be used instead of the global environment. 2) assigning variables to the namespace of the function running the shiny app. 1) is the second answ

Re: [R-pkg-devel] Assignments to the global environment and use of on.exit

2021-06-22 Thread Jeff Newmiller
Just don't. E.g. https://stackoverflow.com/questions/12598242/global-variables-in-packages-in-r On June 22, 2021 1:47:56 AM PDT, Siddhanta Phuyal wrote: > Hello, > >A few weeks ago, I submitted a package to CRAN. The automated system >rejected the package showing the following note: > >Found th

Re: [R-pkg-devel] Assignments to the Global environment

2018-01-07 Thread Duncan Murdoch
On 07/01/2018 12:17 PM, William Dunlap wrote: I think that assigning something to parent.frame() is bad practice, for the same reasons that assigning to .GlobalEnv is bad. You could instead make an environment in your package called, say, "TSEtools.env", with TSETools.env <- new.env() in so

Re: [R-pkg-devel] Assignments to the Global environment

2018-01-07 Thread William Dunlap
I think that assigning something to parent.frame() is bad practice, for the same reasons that assigning to .GlobalEnv is bad. You could instead make an environment in your package called, say, "TSEtools.env", with TSETools.env <- new.env() in some *.R file in the package's R directory. Export

Re: [R-pkg-devel] Assignments to the Global environment

2018-01-07 Thread Saeb
It is done. Thanks for the help! On 01/07/2018 06:11 PM, Hugh Parsonage wrote: I'm not CRAN, but something like this might be permissible while satisfying your requirements. z <- function(..., assign.env = parent.frame(1)) assign(as.character(s), temp3, envir = assign.env) The problem wit

Re: [R-pkg-devel] Assignments to the Global environment

2018-01-07 Thread Hugh Parsonage
I'm not CRAN, but something like this might be permissible while satisfying your requirements. z <- function(..., assign.env = parent.frame(1)) assign(as.character(s), temp3, envir = assign.env) The problem with assigning to the global environment is that z might be called where it is expected

Re: [R-pkg-devel] Assignments to the Global environment

2018-01-07 Thread Saeb
The function downloads the list of index's value and assigned them to the individual's name correspond with the indexes. If remove the .GlobalEnv, then we can not return the values in output. Since, the data is updated daily, I think that the storage on device is not user friendly enough. I al

Re: [R-pkg-devel] Assignments to the Global environment

2018-01-06 Thread Uwe Ligges
Let me add: Frequently you can use storage in an enmvironment in yur package, if that helps to avoid assigning into .GlobalEnv. Best, Uwe Ligges On 06.01.2018 22:07, peter dalgaard wrote: You probably need to tell us what you are trying to achieve. Why do you want to assign temp3 to a variabl

Re: [R-pkg-devel] Assignments to the Global environment

2018-01-06 Thread peter dalgaard
You probably need to tell us what you are trying to achieve. Why do you want to assign temp3 to a variable with its name in s into the global environment? Not doing that would clearly eliminate the Note:, but presumably it has a function. However, writing to the global environment, especially to