Re: [Rd] delayedAssign

2007-09-27 Thread Luke Tierney
On Wed, 26 Sep 2007, Gabor Grothendieck wrote: I thought that perhaps the behavior in the previous post, while inconsistent with the documentation, was not all that harmful but I think its related to the following which is a potentially serious bug. The previous discussion already

Re: [Rd] delayedAssign

2007-09-27 Thread Gabor Grothendieck
Thanks for the explanation. For lists either: (a) promises should be evaluated as they enter the list or (b) promises evaluated as they exit the list (i.e. as they are compared, inspected, etc.). I gather the intent was (a) but it does not happen that way due to a bug in R. Originally I

Re: [Rd] rJava and RJDBC

2007-09-27 Thread Simon Urbanek
Joe, which version of R and RJDBC are you using? The behavior you describe should have been fixed in RJDBC 0.1-4. Please try the latest version from rforge install.packages(RJDBC,,http://rforge.net/;) and please let me know if that solves your problem. Cheers, Simon On Sep 26, 2007, at

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Petr Savicky
On Wed, Sep 26, 2007 at 10:52:28AM -0700, Byron Ellis wrote: For the most part, doing anything to an R object result in it's duplication. You generally have to do a lot of work to NOT copy an R object. Thank you for your response. Unfortunately, you are right. For example, the allocated memory

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Petr Savicky
In my previous email, I sent the example: a - matrix(as.integer(1),nrow=14100,ncol=14100) # 774m a[1,1] - 0 # 3.0g gc() # 1.5g This is misleading. The correct version is a - matrix(as.integer(1),nrow=14100,ncol=14100) # 774m a[1,1] - as.integer(0) # 1.5g gc() # 774m So, the

Re: [Rd] delayedAssign

2007-09-27 Thread Luke Tierney
On Thu, 27 Sep 2007, Gabor Grothendieck wrote: Thanks for the explanation. For lists either: (a) promises should be evaluated as they enter the list or (b) promises evaluated as they exit the list (i.e. as they are compared, inspected, etc.). What makes you conclude that this is what should

Re: [Rd] rJava and RJDBC

2007-09-27 Thread Joe W Byers
Simon Urbanek simon.urbanek at r-project.org writes: Joe, which version of R and RJDBC are you using? The behavior you describe should have been fixed in RJDBC 0.1-4. Please try the latest version from rforge install.packages(RJDBC,,http://rforge.net/;) and please let me know if

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Peter Dalgaard
Petr Savicky wrote: On Wed, Sep 26, 2007 at 10:52:28AM -0700, Byron Ellis wrote: For the most part, doing anything to an R object result in it's duplication. You generally have to do a lot of work to NOT copy an R object. Thank you for your response. Unfortunately, you are right.

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Prof Brian Ripley
1) You implicitly coerced 'a' to be numeric and thereby (almost) doubled its size: did you intend to? Does that explain your confusion? 2) I expected NAMED on 'a' to be incremented by nrow(a): here is my understanding. When you called nrow(a) you created another reference to 'a' in the

[Rd] Aggregate factor names

2007-09-27 Thread Mike Lawrence
Hi all, A suggestion derived from discussions amongst a number of R users in my research group: set the default column names produced by aggregate () equal to the names of the objects in the list passed to the 'by' object. ex. it is annoying to type with( my.data

Re: [Rd] Aggregate factor names

2007-09-27 Thread Gabor Grothendieck
You can do this: aggregate(iris[-5], iris[5], mean) On 9/27/07, Mike Lawrence [EMAIL PROTECTED] wrote: Hi all, A suggestion derived from discussions amongst a number of R users in my research group: set the default column names produced by aggregate () equal to the names of the objects in

Re: [Rd] Aggregate factor names

2007-09-27 Thread Mike Lawrence
Understood, but my point is that the naming I suggest should be the default. One should not be 'punished' for being explicit in calling aggregate. On 27-Sep-07, at 1:06 PM, Gabor Grothendieck wrote: You can do this: aggregate(iris[-5], iris[5], mean) On 9/27/07, Mike Lawrence [EMAIL

Re: [Rd] Aggregate factor names

2007-09-27 Thread Gabor Grothendieck
You can do this too: aggregate(iris[-5], iris[Species], mean) or this: with(iris, aggregate(iris[-5], data.frame(Species), mean)) or this: attach(iris) aggregate(iris[-5], data.frame(Species), mean) The point is that you already don't have to write x = x. The only reason you are writing it

[Rd] Unnecessary extra copy with matrix(..., dimnames=NULL) (Was: Re: modifying large R objects in place)

2007-09-27 Thread Henrik Bengtsson
As others already mentioned, in your example you are first creating an integer matrix and the coercing it to a double matrix by assigning (double) 1 to element [1,1]. However, even when correcting for this mistake, there is an extra copy created when using matrix(). Try this in a fresh vanilla R

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Petr Savicky
Thank you very much for all the explanations. In particular for pointing out that nrow is not a .Primitive unlike dim, which is the reason for the difference in their behavior. (I rised the question of possible bug due to this difference, not just being unsatisfied with nrow). Also, thanks for: