Closed jefferis closed 10 years ago
This is actually related to jefferislab/nat.nblast/issues/11. The question is, where is the best place to determine 1) if an incoming expression should be substituted and 2) what the fall-back environment should be.
See:
http://adv-r.had.co.nz/Computing-on-the-language.html#calling-from-another-function
for discussion
Note that Hadley Wickham strongly recommends having a separate function rather than controlling non-standard evaluation using an argument, but this is not possible for plot3d.neuronlist (though it would be for subset.neuronlist)
My conclusion is that we do not need a parent.generations argument. Rather any calling function should pre-substitute the expression using the appropriate calling environment. This does however have one issue to think about. If there is a variable in the calling environment that has the same name as a data.frame column, it is the callee that takes priority whereas right now it is the data.frame column that takes priority.
Hmm, changed my mind about this again. substitute(x, parent.frame()) does not seem to behave as expected, because some expressions need to be evaluated in the parent.frame, not merely substituted
https://github.com/jefferis/nat/blob/master/R/neuronlist.R#L217-L226