Re: [Rd] "+" for character method...

2006-08-25 Thread Duncan Murdoch
On 8/25/2006 6:52 PM, Bill Dunlap wrote: >>> >> There have been propositions to make "+" work in S (and >>> >> R) like in some other languages, namely for character >>> >> (vectors), >>> >> >>> >> a + b := paste(a,b, sep="") >>> ... >>> yes. I think however if we keep speed and

Re: [Rd] "+" for character method...

2006-08-25 Thread Bill Dunlap
> > >> There have been propositions to make "+" work in S (and > > >> R) like in some other languages, namely for character > > >> (vectors), > > >> > > >> a + b := paste(a,b, sep="") > > ... > > yes. I think however if we keep speed and clarity and catching > > user errors all

Re: [Rd] "+" for character method...

2006-08-25 Thread Duncan Murdoch
On 8/25/2006 4:55 PM, Martin Maechler wrote: >> "Duncan" == Duncan Murdoch <[EMAIL PROTECTED]> >> on Fri, 25 Aug 2006 13:18:42 -0400 writes: > > Duncan> On 8/25/2006 12:31 PM, Martin Maechler wrote: > >> This thread remains me of an old recurring (last May!) > >> theme whic

Re: [Rd] "+" for character method...

2006-08-25 Thread Prof Brian Ripley
1) I'd like to take a look at what is involved before commenting on efficiency issues. They may not be what I thought they were (or at least, being generic at all may be so big a hit that a few more cases may be immaterial). 2) This + is clearly not commutative. 3) + is part of group generic.

Re: [Rd] "+" for character method...

2006-08-25 Thread Martin Maechler
> "Duncan" == Duncan Murdoch <[EMAIL PROTECTED]> > on Fri, 25 Aug 2006 13:18:42 -0400 writes: Duncan> On 8/25/2006 12:31 PM, Martin Maechler wrote: >> This thread remains me of an old recurring (last May!) >> theme which maybe fits well to Friday late afternoon... >>

Re: [Rd] Command line length limits in R

2006-08-25 Thread Prof Brian Ripley
Yes, that's the essence of the problem: long lines get truncated by the R-readline interface and so the next line is appended to part of the previous line (without the closing " in this case). It works from redirected input because the first chunk is syntactically incomplete (and --no-readline

Re: [Rd] OT: authorship and contacts for releasing packages (Re: reshape scaling with large numbers of times/rows)

2006-08-25 Thread Hin-Tak Leung
I think you have fundamentally missed Prof Ripley's point about using non-affilated address while requesting help of a substantial nature. Open-source software doesn't grow on trees. Often some pieces of open-source software can have substantial commercial interests, and those who want something

Re: [Rd] S4 methods for "+"

2006-08-25 Thread Parlamis Franklin
If you plan to do this for certain (non-primitive) "Math" and "Math2" group functions you will also need setGeneric calls of this form: setGeneric("log", group="Math") This much is documented in the "group generic" doc page. What is undocumented (AFAIK), and tripped me up for a while before

Re: [Rd] Command line length limits in R

2006-08-25 Thread Jeffrey Horner
Prof Brian Ripley wrote: > I've been trying to track down some of the issues with command line length > limits, and those writing GUIs/front-ends need to pay some attention to > the issue. > > src/unix/system.txt says > > *int R_ReadConsole(char *prompt, char *buf, int buflen, int hist)

Re: [Rd] "+" for character method...

2006-08-25 Thread Duncan Murdoch
On 8/25/2006 12:31 PM, Martin Maechler wrote: > This thread remains me of an old recurring (last May!) theme > which maybe fits well to Friday late afternoon... > > There have been propositions to make "+" work in S (and R) > like in some other languages, > namely for character (vectors), >

Re: [Rd] OT: authorship and contacts for releasing packages (Re: reshape scaling with large numbers of times/rows)

2006-08-25 Thread Mitch Skinner
If people are annoyed by the off-topic-ness, just let me know and I'll take it off list. Also, I don't expect to necessarily convert anyone to my point of view, but I would like to try and articulate it a bit better (sorry for the length). More inline: On Thu, 2006-08-24 at 20:23 +0100, Hin-Tak

[Rd] "+" for character method...

2006-08-25 Thread Martin Maechler
This thread remains me of an old recurring (last May!) theme which maybe fits well to Friday late afternoon... There have been propositions to make "+" work in S (and R) like in some other languages, namely for character (vectors), a + b := paste(a,b, sep="") IIRC, when this theme cam

[Rd] extensions link to libpthread cause R coredumps when dyn.load('xxx.so')

2006-08-25 Thread assiss
hi, I wrote a simplest c extension to test. xxx.c R CMD SHLIB xxx.c then I run dyn.load('xxx.so'), it worked very well without any question. but if I compiled it with -lphread, xxx.c Makevars with PKG_LIBS=-lpthread R CMD SHLIB xxx.c then I run dyn.load('xxx.so'), R crashed. I run R -d g

Re: [Rd] S4 methods for "+"

2006-08-25 Thread Martin Maechler
> "BDR" == Prof Brian Ripley <[EMAIL PROTECTED]> > on Fri, 25 Aug 2006 12:56:17 +0100 (BST) writes: BDR> Just like any other S4 method: setMethod("+", BDR> c("track", "track"), function(e1, e2) new("track", BDR> x=c([EMAIL PROTECTED], [EMAIL PROTECTED]), y=c([EMAIL PROTECT

Re: [Rd] S4 methods for "+"

2006-08-25 Thread Prof Brian Ripley
Just like any other S4 method: setMethod("+", c("track", "track"), function(e1, e2) new("track", x=c([EMAIL PROTECTED], [EMAIL PROTECTED]), y=c([EMAIL PROTECTED],[EMAIL PROTECTED]))) If you want to write a group generic for the S4 Ops group, you do it very like S3. There are worked e

[Rd] S4 methods for "+"

2006-08-25 Thread Robin Hankin
Hi I'm trying to implement S4 methods in a package, and I am having difficulty defining "+" to do what I want. In the Green Book, there is a discussion of a "track" object, setClass("track", representation(x="numeric", y="numeric")) OK. track1 <- new("track",x=c(1,4,6),y=c(10,11,12)) track2 <-

[Rd] The cost of method dispatch

2006-08-25 Thread Prof Brian Ripley
People often ask for base functions to be made generic. There is a measurable cost: > system.time(for(i in 1:1e6)seq(length=5)) [1] 18.603 0.016 18.621 0.000 0.000 > system.time(for(i in 1:1e6) seq.default(length=5)) [1] 12.515 0.012 12.533 0.000 0.000 > system.time(for(i in 1:1e6) NULL) [