Skip to content
Prev 364976 / 398500 Next

Using with() to avoid $ ?

Yes, variables in the formula should be handled by nse with the data
argument. Got it -- thanks. But still ... can with() be used to handle
those and/or any other variables in foo that appear as arguments. I see no
problems in doing so, but ... ?

Bert

(But see inline below)
On Oct 23, 2016 7:24 PM, "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us> wrote:
the formula with treatment of variables passed as other arguments. It is
sort of like thinking the x symbols in foo$x[ x < 0 ] refer to the same
data.

In my query they explicitly do, though. Nevertheless your response was
apropos.
availability of a data argument such redundancy is unnecessary. NSE is
already in use for the formula. It is not (necessarily) in use for the
other arguments, so you just have to learn which arguments are being
handled with NSE by any particular function and which are not... good docs
would be the preferred avenue but recognizing the error message that arises
when you fail to specify foo$ for the non-formula arguments gets me by if
the docs are unclear.
"with" on top of the existing formula eval-with-data is only likely to
confuse the evaluation context even more.

This is what I'm not sure of. Can you give an example of when such
confusion would occur?
wrote: