[R] R as a programming language

Alexy Khrabrov deliverable at gmail.com
Wed Nov 7 14:17:47 CET 2007


On Nov 7, 2007, at 4:13 PM, Duncan Murdoch wrote:

>> And, still no option processing as in GNU long options, or python  
>> or  ruby's optparse.
>> What's the semantics of parameter passing -- by value or by  
>> reference?
>
> By value.

Thanks Duncan!  So if I have a huge table t, and the idea was to  
write a function t.xy(t, ...) to select slices of it, will parameter  
passing copying waste forfeit all aesthetic savings from  
refactoring?  What I'm dreading is having to explicitly select x and  
y from t,

if (<t has some shape>) {
	plot(t$this, t$that, ...)
} else if (<t has that shape>) {
	plot(t$smth_else, ...)
}

-- that way I do refer to parts of t and there's no copying except to  
plot (?), yet if indeed passing parameters by value copies them, one  
would have to refrain from writing functions!  Is that the state of  
things?

Cheers,
Alexy



More information about the R-help mailing list