[R] Ref: Variable scope or function behaviour or array reassign

Gabor Grothendieck ggrothendieck at myway.com
Tue Oct 26 05:42:33 CEST 2004

Kunal Shetty <kshe4 <at> student.monash.edu> writes:

: Uwe Ligges
:            thank you for u prompt reply
:         my problem was in step3
:         where my function returns two  different arrays.
: Yes i did try returning an object from the array.
: but the problem became...i tired returning the two arrays in a dataframe  
such as
: newXY <- data.frame("newXmean"=newx, "newYmean" =newy)
: but in the calling function or loop;  i wasn't able to access each 
individual array as an array; from the
: assigned object.
:     Output <- algoResult(x,y,xNA,yNA,ctr); Output
:      print(Output)   ?? 
:      print(Output[1])
:      print(Output$newy)
: hence was trying to assign the global arrays within the function  itself 
without bothering to return any object...
:    any help on this..     
: regards
: Kunal

You need to be clearer in your questions.  Reduce your problem to a 
short reproduceable example that runs and then manually provide the 
exact output that you want it to produce but it is not producing.

Reproducable means that someone can copy it from your email, paste it 
into their R session and see the output as you do.   Read the posting 
guide for more info.

More information about the R-help mailing list