background
I support two packages that I would like to add to CRAN. They were rejected because some functions assign variables .GlobalEnv
. Now I'm trying to find another, but convenient way to handle these variables.
packages
Both packages belong to the odorant response database, Do Do. We collect published odor data in a package DoOR.data
; algorithms in a package DoOR.functions
combine this data into a single consensus data set.
supposed functionality
The data packet contains a pre-computed consensus data set. The user can change the basic source data sets (for example, add their own data sets, delete some ...) and calculate a new consensus data set. Therefore, functions must have access to modified datasets.
The easiest way is to load the complete package data into .GlobalEnv
(via a function) and then modify the data. This was also straightforward for the user, as he saw the corresponding datasets in his "main" environment. The problem is that writing to the user environment is bad practice and CRAN does not accept the packet in this way (understandable).
things i tried
.GlobalEnv
, parent.frame()
- Hadley , , , .door.env <- new.env()
.door.env
,attach(door.env)
, , , new.env()
new.env
, ,
, , , , , , ( :))
, - , , .
EDIT: *.RData
/ DoOR.data
. LazyData = true
, .GlobalEnv
. , / .