[R] modifying arrays within functions
kb25532 at sgh.waw.pl
Tue Feb 5 17:32:26 CET 2008
Got it Thanks
> On Tuesday 05 February 2008 (16:51:41), Konrad BLOCHER wrote:
>> I'm pretty new to R and seem to be having difficulties with writing a
>> function that would change an array and keep the change after the
>> finishes its work.
> It seems you want this:
> X[1,1] <<- X[1,1]+a # not '='
> [,1] [,2]
> [1,] 2 1
> [2,] 1 1
> Nevertheless I would advise against writing and using functions that
> have side effects outside their scope.
> It is in general dangerous.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help