Displaying 1 result from an estimated 1 matches for "updateddur".
Did you mean:
updatecdr
2002 Aug 26
5
updating n within for(i in 1:n) loop
Hi folks:
I think I'm having problems with figuring this one out:
test1 <- function()
{
n <- 2
for(i in 1:n)
{
cat(paste("i =", i, "\n")); flush.console()
n <- 5 # version 1
#n <<- 5 # version 2
#assign("n", 5, envir = environment(test1)) # version 3
}
}
I need the for(.) loop to run (say) n=5 times within the