[Rd] local variable assignment: first copies from higher frame?

2013-08-14 Thread Murat Tasan
hi all -- this might not be the correct list for this question/discussion, though R-help didn't seem like the correct venue, either, so... i'm looking for just some extra clarification of how local variables are defined/bound, beyond the simple cases given in the Language document. the particular

Re: [Rd] local variable assignment: first copies from higher frame?

2013-08-16 Thread Murat Tasan
ah, that makes perfect sense in the functional programming sense of things. thanks! On Wed, Aug 14, 2013 at 10:19 PM, Peter Meilstrup wrote: > Not anything that complicated -- your answer is in the R language definition > under 'Subset assignment' and the part in "Function calls" that describes >

[Rd] proper use of reg.finalizer to close connections

2014-10-26 Thread Murat Tasan
Hi all, I have a question about finalizers... I have a package that manages state for a few connections, and I'd like to ensure that these connections are 'cleanly' closed upon either (i) R quitting or (ii) an unloading of the package. So, in a pared-down example package with a single R file, it lo

Re: [Rd] proper use of reg.finalizer to close connections

2014-10-26 Thread Murat Tasan
}) > #> NULL > rm(e) > gc() > #> [1] "bar" "foo" > #> used (Mb) gc trigger (Mb) max used (Mb) > #> Ncells 1528877 81.72564037 137.0 2564037 137.0 > #> Vcells 3752538 28.7 7930384 60.6 7930356 60.6 > > More pr

Re: [Rd] proper use of reg.finalizer to close connections

2014-10-26 Thread Murat Tasan
what happens if you set the finalizer on such an > object in the package. I can imagine that the finalizer will not be > saved into the package, and is only used once, when > building/installing the package. In this case you'll need to set the > finalizer in .onLoad(). > > Gabor

Re: [Rd] proper use of reg.finalizer to close connections

2014-10-26 Thread Murat Tasan
6, 2014 11:03 PM, "Henrik Bengtsson" wrote: > On Sun, Oct 26, 2014 at 8:14 PM, Murat Tasan wrote: > > Ah (again)! > > Even with my fumbling presentation of the issue, you gave me the hint > > that solved it, thanks! > > > > Yes, the reg.finalizer cal

Re: [Rd] proper use of reg.finalizer to close connections

2014-10-27 Thread Murat Tasan
n the state variable container(s), which might not be the most elegant solution, but it should work well enough for most purposes. Cheers and thanks for the advice, -m On Mon, Oct 27, 2014 at 12:18 AM, Murat Tasan wrote: > Ah, good point, I hadn't thought of that detail. > Would moving reg.fi

Re: [Rd] proper use of reg.finalizer to close connections

2014-10-27 Thread Murat Tasan
/Henrik > > On Mon, Oct 27, 2014 at 10:10 AM, Murat Tasan wrote: >> Eh, after some flailing, I think I solved it. >> I _think_ this pattern should guarantee that the finalizer function is >> still present when needed: >> >> .STATE_CONTAINER <- new.env(parent = em

[Rd] common base functions stripping S3 class

2014-11-16 Thread Murat Tasan
Hi all --- this is less a specific question and more general regarding S3 classes. I've noticed that quite a few very common default implementations of generic functions (e.g. `unique`, `[`, `as.data.frame`) strip away class information. In some cases, it appears conditionals have been created to r

[Rd] order(..., na.last = NA) performance hit

2015-01-19 Thread Murat Tasan
I've just recently noticed that using the na.last = NA setting with order incurs a HUGE performance hit. It appears that much of order(...) (the R wrapper, not the internal calls) is written in as general a manner as possible to handle the large number of input types. But the canonical case of orde