changing the value of a variable from inside a function
Michael,
I feel sure people are going to come up with other better suggestions
here but does <- work for you?
test <- matrix(NA,nrow=4,ncol=3)
test[1,] <- c(1,2,3)
blah <- function(i){
test[i,] <<- c(0,1,2) + i
return(test)
}
On Tue, 2005-15-11 at 12:22 -0500, Michael Wolosin wrote:
test <- matrix(NA,nrow=4,ncol=3)
test[1,] <- c(1,2,3)
blah <- function(i){
test[i,] <- c(0,1,2) + i
return(test)
}
test
blah(2)
test