[R] modifying arrays within functions
Konrad BLOCHER
kb25532 at sgh.waw.pl
Tue Feb 5 16:49:41 CET 2008
Hi,
I'm preetty new to R and seem to be having difficulties with writing a
function that would change an array and keep the change after the function
finishes its work.
in other words
I have an array of 1's X<-array(1,dim=c(2,2))
I want to add a number to X[1,1] by means of a function called addition.
What I am writing is: addition<-function(a){X[1,1]=X[1,1}+a}
but it doesn't seem to work
Any ideas? Please? :)
Thanks
KB
More information about the R-help
mailing list