Re: [R] with vs. attach

2016-05-09 Thread Hadley Wickham
On Mon, May 9, 2016 at 7:12 AM, peter dalgaard wrote: > > On 09 May 2016, at 02:46 , Bert Gunter wrote: > >> ... To be clear, Hadley or anyone else should also feel free to set me >> straight, preferably publicly, but privately if you prefer. > > Not really to "set anyone straight", but there are

Re: [R] with vs. attach

2016-05-09 Thread Hadley Wickham
On Sun, May 8, 2016 at 7:28 PM, Bert Gunter wrote: > Jeff: > > That's easy to do already with substitute(), since you can pass around > an unevaluated expression (a parse tree) however you like. As I read > it, (admittedly quickly) what it's main feature is that it allows you > more control over t

Re: [R] with vs. attach

2016-05-09 Thread peter dalgaard
On 09 May 2016, at 02:46 , Bert Gunter wrote: > ... To be clear, Hadley or anyone else should also feel free to set me > straight, preferably publicly, but privately if you prefer. Not really to "set anyone straight", but there are some subtleties with mode call objects versus expression objec

Re: [R] with vs. attach

2016-05-08 Thread Bert Gunter
... To be clear, Hadley or anyone else should also feel free to set me straight, preferably publicly, but privately if you prefer. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "B

Re: [R] with vs. attach

2016-05-08 Thread Bert Gunter
Jeff: That's easy to do already with substitute(), since you can pass around an unevaluated expression (a parse tree) however you like. As I read it, (admittedly quickly) what it's main feature is that it allows you more control over the environment in which the expression is finally evaluated --

Re: [R] with vs. attach

2016-05-08 Thread Jeff Newmiller
The lazyeval package addresses the problem of how to delay evaluation even when the function you want to do the evaluation in is buried two or more function calls below where the original call was made. If you are not building nested function calls with delayed evaluation then you probably don't

Re: [R] with vs. attach

2016-05-08 Thread Spencer Graves
Hi, Hadley et al.: Hadley's link requires his development version of "lazyeval", which can be obtained as follows: library(devtools) install_github("hadley/lazyeval") Hadley's link describes real problems with elegant solutions. However, David's solution solved my immed

Re: [R] with vs. attach

2016-05-06 Thread Hadley Wickham
You may want to read http://rpubs.com/hadley/157957, which captures my latest thinking (and tooling) around this problem. Feedback is much appreciated. Hadley On Fri, May 6, 2016 at 2:14 PM, David Winsemius wrote: > >> On May 6, 2016, at 5:47 AM, Spencer Graves >> wrote: >> >> >> >> On 5/6/201

Re: [R] with vs. attach

2016-05-06 Thread David Winsemius
> On May 6, 2016, at 5:47 AM, Spencer Graves > wrote: > > > > On 5/6/2016 6:46 AM, peter dalgaard wrote: >> On 06 May 2016, at 02:43 , David Winsemius wrote: >> On May 5, 2016, at 5:12 PM, Spencer Graves wrote: I want a function to evaluate one argument in the en

Re: [R] with vs. attach

2016-05-06 Thread Spencer Graves
On 5/6/2016 6:46 AM, peter dalgaard wrote: On 06 May 2016, at 02:43 , David Winsemius wrote: On May 5, 2016, at 5:12 PM, Spencer Graves wrote: I want a function to evaluate one argument in the environment of a data.frame supplied as another argument. "attach" works for this, but "with" d

Re: [R] with vs. attach

2016-05-06 Thread peter dalgaard
On 06 May 2016, at 02:43 , David Winsemius wrote: > >> On May 5, 2016, at 5:12 PM, Spencer Graves >> wrote: >> >> I want a function to evaluate one argument >> in the environment of a data.frame supplied >> as another argument. "attach" works for >> this, but "with" does not. Is there a wa

Re: [R] with vs. attach

2016-05-06 Thread Spencer Graves
On 5/5/2016 11:17 PM, Bert Gunter wrote: ... and it's exactly with.default's code ! Thanks for pointing that out. Unfortunately, it didn't work inside another function. However, if I had looked at it, I might have been able to thought to try it. Spencer Cheers, Bert Bert Gunter "Th

Re: [R] with vs. attach

2016-05-05 Thread Bert Gunter
... and it's exactly with.default's code ! Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, May 5, 2016 at 7:38 PM, Spencer Graves wrote: >

Re: [R] with vs. attach

2016-05-05 Thread Spencer Graves
Hi, David: That works. Thanks very much. Spencer Graves On 5/5/2016 7:43 PM, David Winsemius wrote: On May 5, 2016, at 5:12 PM, Spencer Graves wrote: I want a function to evaluate one argument in the environment of a data.frame supplied as another argument. "attach" works for this, but

Re: [R] with vs. attach

2016-05-05 Thread David Winsemius
> On May 5, 2016, at 5:12 PM, Spencer Graves > wrote: > > I want a function to evaluate one argument > in the environment of a data.frame supplied > as another argument. "attach" works for > this, but "with" does not. Is there a way > to make "with" work? I'd rather not attach > the data.fra

[R] with vs. attach

2016-05-05 Thread Spencer Graves
I want a function to evaluate one argument in the environment of a data.frame supplied as another argument. "attach" works for this, but "with" does not. Is there a way to make "with" work? I'd rather not attach the data.frame. With the following two functions "eval.w.attach" works but "eval.w