Displaying 1 result from an estimated 1 matches for "myfunk".
Did you mean:
myfun
2005 Oct 07
2
Assign references
...y function
that simply sets a couple of variables (well, tries but fails).
Searching the archives, Thomas Lumley recently explained the <<-
operator, showing that it was necessary for x and y to exist prior to
the function call, but I haven't the faintest why this isn't working:
> myFunk<-function(a,b,foo,bar) {foo<<-a+b; bar<<-a*b;}
> x<-0; y<-0;
> myFunk(4,5,x,y)
> x<-0; y<-0;
> myFunk(4,5,x,y)
> x
[1] 0
> y
[1] 0
What (no doubt simple) reason is there for x and y not changing?
Thank you,
cur
--
Curt Seeliger, Data Ranger
CSC, EPA/WE...