Re: [Rd] substitute and S4 objects

2007-03-24 Thread John Chambers
First, by "doesn't work" you mean the printed output. The value returned is the same. Second, the problem is not a general one with S4 methods but with primitive functions. To see this, define a real function with a similar method: > setGeneric("foo", function(e1, e2) standardGeneric("foo")

Re: [Rd] Subtle bug in do_basename

2007-03-24 Thread Duncan Murdoch
On 3/24/2007 6:02 PM, Jeffrey Horner wrote: > Hello, > > > I've been wondering why my no-optimization R-devel builds have been > hanging during "building/updating package indices ...". I tracked it > down with gdb to this line from do_basename in utils.c: > > while ( *(p = buf + strlen(buf) -

[Rd] Subtle bug in do_basename

2007-03-24 Thread Jeffrey Horner
Hello, I've been wondering why my no-optimization R-devel builds have been hanging during "building/updating package indices ...". I tracked it down with gdb to this line from do_basename in utils.c: while ( *(p = buf + strlen(buf) - 1) == fsp ) *p = '\0'; Now, imagine if your compiler places

Re: [Rd] as.Date nuance

2007-03-24 Thread Gabor Grothendieck
It matches in the sense of grep or regexpr grep("a", "ab") > 0 regexpr("a", "ab") > 0 Try this: x <- c("2006-01-01error", "2006-01-01") as.Date(x, "%Y-%m-%d") + ifelse(regexpr("^-..-..$", x) > 0, 0, NA) On 3/24/07, Vladimir Dergachev <[EMAIL PROTECTED]> wrote: > On Saturday 24 March 2007

Re: [Rd] as.Date nuance

2007-03-24 Thread Vladimir Dergachev
On Saturday 24 March 2007 6:21 am, Prof Brian Ripley wrote: > This is how strptime() works: it processes the input to match the format. Except that the format does not match the string - there are leftover characters. Even by R's own definition: > match("a", "ab") [1] NA as, of course, is reaso

[Rd] substitute and S4 objects

2007-03-24 Thread Franck Arnaud
Hi all, I don't understand why this does not what I expect : ## code start here ## setClass("num",representation(x="numeric")) num<-function(x) new("num",x=x) add<-function(e1,e2) { cat("Computing ",deparse(substitute(e1)),"+",deparse(substitute(e2)),"\n") [EMAIL PROTECTED]@x

Re: [Rd] as.Date nuance

2007-03-24 Thread Prof Brian Ripley
This is how strptime() works: it processes the input to match the format. On Fri, 23 Mar 2007, Vladimir Dergachev wrote: > I have encountered a nuance in as.Date() behaviour that is not altogether > obvious - not sure whether this is intended or not: > >> as.Date("2001-01-01error") > [1] "2001-0