Displaying 1 result from an estimated 1 matches for "eival".
Did you mean:
einval
2011 Mar 16
4
Scope of variable?
...unable to access a variable outside the scope of a for loop, even when
the variable was defined before the loop:
haar <- function() {
a = c(1.4560773, 2.3752412, 0.9798882, 3.0909252, 2.3986487, 1.8581543)
for (i in c(1:100)) {
m = matrix(rnorm(36)+1i*rnorm(36),6)
qrm = qr(m)
Q = qr.Q(qrm)
eival = eigen(Q, only.values=T)
ph = Arg(eival$values)
v = Mod(ph)
a = cat(a,v)
}
hist(a)
}
The hist command does not plot because a is null there.
How do I plot a? I tried using
assign("a", a, envir = .GlobalEnv)
but that does not help either... Neither did u...