Wonderful! Thanks. I think I've got it. You can even put
this <- environment() at the top as long as this is returned at the end. I gather that the environment keeps accumulating elements even though it is assigned to 'this' at the beginning. I had thought that $ worked only on lists, but I guess it works on environment objects also. > typeof(x) [1] "environment" > is.list(x) [1] FALSE *-- Russ * *_____________________________________________* *** Professor, Computer Science* * California State University, Los Angeles* * Google voice: 747-*999-5105 * blog: *http://russabbott.blogspot.com/ vita: http://sites.google.com/site/russabbott/ *_____________________________________________* On Sat, Mar 19, 2011 at 7:21 PM, Kenn Konstabel <lebats...@gmail.com> wrote: > On Sun, Mar 20, 2011 at 4:13 AM, Kenn Konstabel <lebats...@gmail.com>wrote: > >> you can omit the list and do the following: >> >> >> /.../ >> >> (but you don't really need "this" in this case as you can use "balance" >> instead of "this$balance") >> > > P.S. using "this" would make some difference in one case: > > instead of > total <<- total + amount # need <<- here > you can have > this$total <- this$total + amount # can use <- > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.