[R] print value of variable to screen or alert box?
ggrothendieck at gmail.com
Sat May 2 16:51:40 CEST 2009
See ?cat, e.g.
> v <- seq(10, 50, 10)
> for(i in seq_along(v)) cat("v[", i, "] =", v[i], "\n")
v[ 1 ] = 10
v[ 2 ] = 20
v[ 3 ] = 30
v[ 4 ] = 40
v[ 5 ] = 50
On Sat, May 2, 2009 at 7:59 AM, onyourmark <william108 at gmail.com> wrote:
> I am trying to debug a loop. Is there a way to print the value of a variable
> that is inside a loop? I have a vector v and inside a loop I have v[i] where
> i is the index of the loop. Is there a way to see v[i] per loop so that I
> can see what is going on?
> View this message in context: http://www.nabble.com/print-value-of-variable-to-screen-or-alert-box--tp23345523p23345523.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help