[R] "may be used in an incorrect context"

Ross Boylan ross at biostat.ucsf.edu
Tue Jul 19 02:48:47 CEST 2011


R CMD check tells me
* checking R code for possible problems ... NOTE
agexact.fit.rds: ... may be used in an incorrect context: ‘optim(init,
  agfitfn, ...)’
Warning: <anonymous>: ... may be used in an incorrect context: ‘optim(init, agfitfn, ...)’

Can anyone tell me what this message means?  My searches haven't turned
up anything useful.  This is with R 2.7 and 2.9.

The message appears to be referring to a section of code whose
highlights are
    agfitfn <- function(beta) {
      r <- .C("agexactrds", iter= as.integer(control$iter.max),
		   as.integer(n),
		   as.integer(nvar), sstart, sstop,
		   sstat,
		   x= x[sorted,],
                sextra,
                as.integer(length(response.prob)),
                as.double(response.prob),
                as.double(alpha),
		   as.double(offset[sorted] - mean(offset)),
		   newstrat,
		   means = double(nvar),
		   coef= as.double(beta),
		   u = double(nvar),
		   imat= double(nvar*nvar), loglik=double(2),
		   flag=integer(1),
		   double(2*nvar*nvar +nvar*4 + n),
		   integer(2*n),
		   as.double(control$eps),
		   as.double(control$toler.chol),
		   sctest=double(1),
                as.integer(length(debugfile)),
                as.character(debugfile),
                as.integer(1),  # dumb mode
                PACKAGE="survivalrds" )
      - r$loglik[2]
    }
    r <- optim(init, agfitfn, ...)
    return(r)

All of this is in the body of 
agexact.fit.rds <- function([stuff] {
	[more stuff]
}
   
Thanks.
Ross



More information about the R-help mailing list