Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-09 Thread Pavel N. Krivitsky
Hi, I wouldn't call it a bug, but it's a documented limitation, if you know how to read it. As documented, the expression is evaluated with the caller's environment as the parent environment. But here the caller is some code in lapply, not your function f. x is not found there. Thanks!

[R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread Pavel N. Krivitsky
Hi, I have a list of sublists, and I want to add and/or remove elements in each sublist in accordance with a code snippet. I had thought that an elegant way to do that is using a combination of lapply() and within(). However, the code in the within() call doesn't seem to be able to see objects

Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread Duncan Murdoch
On 07/01/2014 10:35 AM, Pavel N. Krivitsky wrote: Hi, I have a list of sublists, and I want to add and/or remove elements in each sublist in accordance with a code snippet. I had thought that an elegant way to do that is using a combination of lapply() and within(). However, the code in the

Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread peter dalgaard
On 07 Jan 2014, at 19:19 , Duncan Murdoch murdoch.dun...@gmail.com wrote: I wouldn't call it a bug, but it's a documented limitation, if you know how to read it. As documented, the expression is evaluated with the caller's environment as the parent environment. But here the caller is some