R-alpha: more bugs

Thomas Lumley (thomas@biostat.washington.edu)
Mon, 28 Oct 1996 11:10:19 -0800 (PST)


Date: Mon, 28 Oct 1996 11:10:19 -0800 (PST)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: r-testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: more bugs
In-Reply-To: <Pine.SUN.3.91.961021110733.1652A-100000@avon>

2.5 more bugs:

1. terms.formula(,specials=) returns at most one of any given type of 
"special".  This will rarely cause problems but they're going to be 
really mysterious when it does.

2. sapply() doesn't work.  It needs to convert the argument to a list before 
calling lapply():
sapply := function(X, FUN, ..., simplify = T)
{
  if(is.character(FUN))
    FUN <- get(FUN, mode = "function")
    else if(mode(FUN) != "function") {
      farg <- substitute(FUN)
      if(mode(farg) == "name")
        FUN <- get(farg, mode = "function")
        else stop(paste("\"", farg, "\" is not a function", sep = ""))
    }

### Change
  answer <- lapply(as.list(X), FUN, ...)
### end of change

  if(simplify && length(answer) &&
     length(common.len <- unique(unlist(lapply(answer, length)))) == 1) {
    if(common.len == 1)
      unlist(answer, recursive = F)
    else if(common.len > 1)
      array(unlist(answer, recursive = F),
            c(common.len, length(X)), list(NULL, names(answer)))
    else answer
  } else answer
}


2.5 I don't know that this is a bug but it sure looks suspicious.
In model.c, in do_modelmatrix, at the 16th line

        intercept = asLogical(getAttrib(terms, install("intercept")));
        if(intercept == NA_INTEGER) intercept = 0;

        response = asLogical(getAttrib(terms, install("response")));
        if(intercept == NA_INTEGER) response = 0;

I would guess that the second test should involve response rather than 
intercept.


thomas lumley
UW Biostat
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-