Re: [Rd] [[.data frame and row names

2007-07-11 Thread Prof Brian Ripley
On Wed, 11 Jul 2007, Herve Pages wrote: > Hi, > > I'm wondering why indexing a data frame by row name doesn't work > with [[. It works with [: > > > sw <- swiss[1:5,1:2] > > sw["Moutier", "Agriculture"] > [1] 36.5 > > but not with [[: > > > sw[["Moutier", "Agriculture"]] > Error in .subset2(.

[Rd] [[.data frame and row names

2007-07-11 Thread Herve Pages
Hi, I'm wondering why indexing a data frame by row name doesn't work with [[. It works with [: > sw <- swiss[1:5,1:2] > sw["Moutier", "Agriculture"] [1] 36.5 but not with [[: > sw[["Moutier", "Agriculture"]] Error in .subset2(.subset2(x, ..2), ..1) : subscript out of bounds The probl

Re: [Rd] sweep sanity checking?

2007-07-11 Thread Tony Plate
Just an opinion from an R user: I think it's a sound idea. I use my own version of sweep with a stricter check: it stops if the vector is not exactly the right length. -- Tony Plate Ben Bolker wrote: > Ben Bolker zoo.ufl.edu> writes: > > >> What would R-core think of the following 'enhan

Re: [Rd] cleanup and Makevars

2007-07-11 Thread Duncan Temple Lang
Hi Kasper This is not an immediate solution for your problem, but a suggestion that the "ideal" solution might be different from what you are asking for. In many projects, when we need to compile the same source file for two or more different purposes (e.g. architectures, compilation flags, etc

Re: [Rd] cleanup and Makevars

2007-07-11 Thread Kasper Daniel Hansen
On Jul 11, 2007, at 9:30 AM, Prof Brian Ripley wrote: > On Mon, 9 Jul 2007, Kasper Daniel Hansen wrote: > >> Hi >> >> This is a question prompted by the mac version of R, but as I see it, >> it should have broader interest. >> >> These days the CRAN Mac binary per default compiles every package f

Re: [Rd] cleanup and Makevars

2007-07-11 Thread Prof Brian Ripley
On Mon, 9 Jul 2007, Kasper Daniel Hansen wrote: > Hi > > This is a question prompted by the mac version of R, but as I see it, > it should have broader interest. > > These days the CRAN Mac binary per default compiles every package for > two architectures. First i386 and then ppc. In between the t

Re: [Rd] Getting param names of primitives

2007-07-11 Thread Gabor Grothendieck
These don't work either: args(match.fun("{")) args("{") On 7/11/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > On Wed, 11 Jul 2007, Duncan Murdoch wrote: > > > On 7/11/2007 9:40 AM, Seth Falcon wrote: > >> Prof Brian Ripley <[EMAIL PROTECTED]> writes: > >> > >>> My problem is that if we mak

Re: [Rd] Getting param names of primitives

2007-07-11 Thread Prof Brian Ripley
On Wed, 11 Jul 2007, Duncan Murdoch wrote: > On 7/11/2007 9:40 AM, Seth Falcon wrote: >> Prof Brian Ripley <[EMAIL PROTECTED]> writes: >> >>> My problem is that if we make formals() work on primitives, people will >>> expect >>> >>> formals(log) <- value >>> >>> to work, and it cannot. >> >>

Re: [Rd] Getting param names of primitives

2007-07-11 Thread Duncan Murdoch
On 7/11/2007 9:40 AM, Seth Falcon wrote: > Prof Brian Ripley <[EMAIL PROTECTED]> writes: > >> My problem is that if we make formals() work on primitives, people will >> expect >> >> formals(log) <- value >> >> to work, and it cannot. > > But it could give an informative error message. Asking fo

Re: [Rd] Getting param names of primitives

2007-07-11 Thread Gabor Grothendieck
Even that does not appear to work everywhere. Either of these returns NULL: formals(args("{")) formals(args(match.fun("{"))) > R.version.string # XP [1] "R version 2.5.1 (2007-06-27)" On 7/11/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > > formals(args(log)) > $x > > > $base > exp(1) > > g

Re: [Rd] Getting param names of primitives

2007-07-11 Thread Seth Falcon
Prof Brian Ripley <[EMAIL PROTECTED]> writes: > My problem is that if we make formals() work on primitives, people will > expect > > formals(log) <- value > > to work, and it cannot. But it could give an informative error message. Asking for formals() seems to make sense so making it work seems

Re: [Rd] Getting param names of primitives

2007-07-11 Thread Prof Brian Ripley
My problem is that if we make formals() work on primitives, people will expect formals(log) <- value to work, and it cannot. On Wed, 11 Jul 2007, Martin Maechler wrote: >> "BDR" == Prof Brian Ripley <[EMAIL PROTECTED]> >> on Wed, 11 Jul 2007 05:48:56 +0100 (BST) writes: > >>> f

Re: [Rd] Getting param names of primitives

2007-07-11 Thread Martin Maechler
> "BDR" == Prof Brian Ripley <[EMAIL PROTECTED]> > on Wed, 11 Jul 2007 05:48:56 +0100 (BST) writes: >> formals(args(log)) BDR> $x BDR> $base BDR> exp(1) BDR> gives what formals(log) used to. (I knew). I've been asking myself several times now, if we should not m

Re: [Rd] [R] How to preserve data across function calls in a library package

2007-07-11 Thread Saptarshi Guha
On Jul 10, 2007, at 12:33 PM, Saptarshi Guha wrote: > Hi, > Some progress: I am using > SEXP retty; > book=Calloc(1,int); > *book=10; > PROTECT(retty=R_MakeExternalPtr(book,R_NilValue,R_NilValue)); > > then UNPROTECTING and returning retty. > > In