[R] Return a list
hadley wickham
h.wickham at gmail.com
Sat Sep 27 00:05:01 CEST 2008
> it depends on what the original author wanted.
>
> with constructs a new environment, and all assignments, if any, made in
> the expression evaluated within with are invisible to the outside
> (unless one plays with environments, again):
>
> x = 1:10
> a = 3
> with(test(), { x[1:3] = c(a,b,c); x = x+d; a = a + 1 })
> x # still 1:10, whatever test returns
> a # still 3. whatever test returns
>
> if the author wanted the values included in the list to be visible and
> accessible by simple names, and used in assignments in a larger part of
> code, using with might be inconvenient.
What about within ?
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list