[R] monitor variable change

2011-02-16 Thread Alaios
Dear all I would like to ask you if there is a way in R to monitor in R when a value changes. Right now I use the sprintf('my variables is %d \n, j) to print the value of the variable. Is it possible when a 'big' for loop executes to open in a new window to dynamically check only the

Re: [R] monitor variable change

2011-02-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/16/2011 10:38 AM, Alaios wrote: Dear all I would like to ask you if there is a way in R to monitor in R when a value changes. Right now I use the sprintf('my variables is %d \n, j) to print the value of the variable. Is it possible

Re: [R] monitor variable change

2011-02-16 Thread Alaios
I think we are both talking for watchpoints-breakpoints --- On Wed, 2/16/11, Rainer M Krug r.m.k...@gmail.com wrote: From: Rainer M Krug r.m.k...@gmail.com Subject: Re: [R] monitor variable change To: Alaios ala...@yahoo.com Cc: R-help@r-project.org Date: Wednesday, February 16, 2011, 9:54

Re: [R] monitor variable change

2011-02-16 Thread Rainer M Krug
r.m.k...@gmail.com Subject: Re: [R] monitor variable change To: Alaios ala...@yahoo.com Cc: R-help@r-project.org Date: Wednesday, February 16, 2011, 9:54 AM On 02/16/2011 10:38 AM, Alaios wrote: Dear all I would like to ask you if there is a way in R to monitor in R when a value changes

Re: [R] monitor variable change

2011-02-16 Thread Jan van der Laan
. Jan Quoting Alaios ala...@yahoo.com: I think we are both talking for watchpoints-breakpoints --- On Wed, 2/16/11, Rainer M Krug r.m.k...@gmail.com wrote: From: Rainer M Krug r.m.k...@gmail.com Subject: Re: [R] monitor variable change To: Alaios ala...@yahoo.com Cc: R-help@r-project.org

Re: [R] monitor variable change

2011-02-16 Thread Rainer M Krug
-breakpoints --- On Wed, 2/16/11, Rainer M Krug r.m.k...@gmail.com wrote: From: Rainer M Krug r.m.k...@gmail.com Subject: Re: [R] monitor variable change To: Alaios ala...@yahoo.com Cc: R-help@r-project.org Date: Wednesday, February 16, 2011, 9:54 AM On 02/16/2011 10:38 AM, Alaios wrote: Dear

Re: [R] monitor variable change

2011-02-16 Thread Erich Neuwirth
You could use any of the gui toolkits (tcltk, gWidgets ...) and create a watch window which displays the changing value of your variable in a popup widged. On 2/16/2011 10:54 AM, Rainer M Krug wrote: On 02/16/2011 10:38 AM, Alaios wrote: Dear all I would like to ask you if there is a way in R

Re: [R] monitor variable change

2011-02-16 Thread Hadley Wickham
You can replace the previous line by: browser(expr=(a!=old.a) see ?browser for details. I don't understand why you'd want to do that - using if is much more readable to me (and is much more general!) Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics /

Re: [R] monitor variable change

2011-02-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/16/2011 03:24 PM, Hadley Wickham wrote: You can replace the previous line by: browser(expr=(a!=old.a) see ?browser for details. I don't understand why you'd want to do that - using if is much more readable to me (and is much more

Re: [R] monitor variable change

2011-02-16 Thread Hadley Wickham
One way to implement this functionality is with a task manager callback: watch - function(varname) { old - get(varname) changed - function(...) { new - get(varname) if (!identical(old, new)) { message(varname, is now , new) old - new } TRUE }

Re: [R] monitor variable change

2011-02-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/16/2011 03:29 PM, Hadley Wickham wrote: One way to implement this functionality is with a task manager callback: watch - function(varname) { old - get(varname) changed - function(...) { new - get(varname) if

Re: [R] monitor variable change

2011-02-16 Thread Duncan Murdoch
On 16/02/2011 9:04 AM, Jan van der Laan wrote: One possible solution is to use something like: a- 0 for (i in 1:1E6) { old.a- a # do something e.g. a- runif(1) 1E-6 if (a != old.a) browser() } Another solution is to write your output to file (using sink for example)