Re: [Rd] checkpointing

2006-01-06 Thread Ross Boylan
Here's some code I put together for checkpointing a function being optimized. Hooking directly into optim would require modifying its C code, so this seemed the easiest route. I've wanted more information on the iterations than is currently provided, so this stuff some info back in the calling env

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread hpages
Thomas Lumley wrote: >On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote: > > > >>hi - in version 2.1 the command >> >> >> >>>-2^2 >>> >>> >>gives >> >>-4 >> >>as the answer. (-2)^2 is evaluated correctly. >> >> > >So is -2^2. The precedence of ^ is higher than that of unary minus. It

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread Herve Pages
Thomas Lumley wrote: >On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote: > > > >>hi - in version 2.1 the command >> >> >> >>>-2^2 >>> >>> >>gives >> >>-4 >> >>as the answer. (-2)^2 is evaluated correctly. >> >> > >So is -2^2. The precedence of ^ is higher than that of unary minus. It

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread Brahm, David
While we're swapping precedence tales, can you guess what this gives: > q <- TRUE > 2 + !q + 3 It's "2", not "5". Bit me in the arse just the other day :-) -- David Brahm ([EMAIL PROTECTED]) __ R-devel@r-project.org mailing list https://stat.ethz.ch/

[Rd] 'cannot create directory' bug fixed

2006-01-06 Thread Herve Pages
Hi everybody, I'd like to report that the 'cannot create directory' bug that we used to have with 'R CMD build' on Windows (and sometimes on Linux too) seems to have disappeared. It's really nice because, thanks to this fix, for the first time we have a reliable automated build system for the

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread p . dalgaard
Thomas Lumley <[EMAIL PROTECTED]> writes: > On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote: > > > hi - in version 2.1 the command > > > > >-2^2 > > > > gives > > > > -4 > > > > as the answer. (-2)^2 is evaluated correctly. > > So is -2^2. The precedence of ^ is higher than that of unary minus. It

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread Peter Dalgaard
Thomas Lumley <[EMAIL PROTECTED]> writes: > On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote: > > > hi - in version 2.1 the command > > > > >-2^2 > > > > gives > > > > -4 > > > > as the answer. (-2)^2 is evaluated correctly. > > So is -2^2. The precedence of ^ is higher than that of unary minus. It

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread Gabor Grothendieck
Precedence rules are tricky, in general, and the usual advice with most programming languages is to liberally use parentheses when in doubt. Its actually not that surprising in this case but consider 0-1:3 and -1:3 which give different results since one uses binary minus and the other uses unary m

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread roger bos
How do people even notice stuff like this. You would never hard-coding (-2)^2 or -2^2 anyway. The part being squared would be a variable, in which case it works correctly: > a<- -2 > a [1] -2 > a^2 [1] 4 Sometimes it seems that people go looking for bugs... and therefore see bugs all around them

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread ggrothendieck
On 1/6/06, Thomas Lumley <[EMAIL PROTECTED]> wrote: > On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote: > > > hi - in version 2.1 the command > > > > >-2^2 > > > > gives > > > > -4 > > > > as the answer. (-2)^2 is evaluated correctly. > > So is -2^2. The precedence of ^ is higher than that of unary mi

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread Gabor Grothendieck
On 1/6/06, Thomas Lumley <[EMAIL PROTECTED]> wrote: > On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote: > > > hi - in version 2.1 the command > > > > >-2^2 > > > > gives > > > > -4 > > > > as the answer. (-2)^2 is evaluated correctly. > > So is -2^2. The precedence of ^ is higher than that of unary mi

Re: [Rd] Multiplication (PR#8466)

2006-01-06 Thread Thomas Lumley
On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote: > hi - in version 2.1 the command > > >-2^2 > > gives > > -4 > > as the answer. (-2)^2 is evaluated correctly. So is -2^2. The precedence of ^ is higher than that of unary minus. It may be surprising, but it *is* documented and has been in S for a l

[Rd] Multiplication (PR#8466)

2006-01-06 Thread casella
hi - in version 2.1 the command >-2^2 gives -4 as the answer. (-2)^2 is evaluated correctly. Cheers, George Casella -- George Casella Phone: (352) 392-1941 Ext. 204 Distinguished Professor and Chair Cell: (352) 682-7210 Department of Statistics

Re: [Rd] Using STL containers in R/C++

2006-01-06 Thread Paul Roebuck
On Thu, 5 Jan 2006, Dominick Samperi wrote: > Dirk Eddelbuettel wrote: > >> Dominick Samperi wrote a Rcpp.{hpp,cpp} class for >> C++ to R interface that is used in RQuantLib. Dominick >> was musing about releasing this stand-alone to CRAN >> as well, but I don't think it has happened. > > It just

Re: [Rd] extending lattice to S4 classes

2006-01-06 Thread ernesto
Deepayan Sarkar wrote: >On 10/20/05, ernesto <[EMAIL PROTECTED]> wrote: > >[...] > > > >>Hi Deepayan, >> >>I see that there are alternatives, I found one my self that works and >>it's transparent for the user. >> >>I don't want to implement solutions that force the user to use lattice >>methods

Re: [Rd] Q: R 2.2.1: Memory Management Issues?

2006-01-06 Thread Prof Brian Ripley
On Thu, 5 Jan 2006, Simon Urbanek wrote: > Karen, > > On Jan 5, 2006, at 5:18 PM, <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> wrote: > >> I am trying to run a R script which makes use of the MCLUST package. >> The script can successfully read in the approximately 17000 data >> points ok, but then th