On Tue, Feb 3, 2009 at 10:56 PM, laurent <lgaut...@gmail.com> wrote:
> On Tue, 2009-02-03 at 13:30 -0800, Nathaniel Smith wrote:
>> why does EnvironmentSexp_ass_subscript (==
>> rpy2.rinterface.SexpEnvironment.__setitem__) copy the value it is
>> storing?
>>
>>   PROTECT(sexp_copy = Rf_duplicate(sexp));
>>   Rf_defineVar(sym, sexp_copy, rho_R);
>
> That's from the early development days, when I was getting very frequent
> segfaults. That was to be on the safe side since R itself is often doing
> a lot of copies; a second look at that (and try to minimize the number
> of copies) is on the ever growing to-do list...

Fair enough.

> # rinterface
> import rpy2.rinterface as ri
> ri.initr()
>
> x = ri.FloatSexpVector([1,2,3,4])
> x = ri.globalEnv.get("dim<-")(x, ri.IntSexpVector([2, 2]))

Right... dim<- is copying the vector and then returning the modified
copy. I want dim<- to mutate the vector in place, like it does when
you call it in R :-).

Since I sent that message, though, I have learned a bit more about the
quirky stuff R's runtime does, and am no longer convinced this is
possible in general... sigh.

-- Nathaniel

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to