pbreheny/grpreg — pull request #1 by vincentarelbundock (2014-01-02 14:46:53+00:00)
Title: BUG: pass lambda explicitly to cv.grpreg

Bug occurence:

library(grpreg)
X = matrix(rnorm(10000), ncol=10)
y = rnorm(1000)
mod = grpreg(X,y,1:ncol(X),lambda=c(2,1))
mod_cv = cv.grpreg(X,y,1:ncol(X),lambda=c(2,1))
> Error in grpreg(X1, y1, g, lambda = fit$lambda, warn = FALSE, ...) :
> formal argument "lambda" matched by multiple actual arguments

Reason:

Line 46 of cv.grpreg:

fit.i <- grpreg(X1, y1, g, lambda=fit$lambda, warn=FALSE, ...)

Which passes lambda twice, once explicitly, and once more implicitly through ``...``

Solution: Just make lambda explicit in the cv.grpreg call.