Skip to content
Prev 256878 / 398506 Next

How to see a R code from a package?

You could also just download the source package from CRAN and look through it.

The thing is, the predict.cv.glmnet function isn't exported by the
package (via its namespace file) -- so it's somehow protected. You
could still see it using `:::`, like so:

R> glmnet:::predict.cv.glmnet
function(object,newx,s=c("lambda.1se","lambda.min"),...){
  if(is.numeric(s))lambda=s
  else
    if(is.character(s)){
      s=match.arg(s)
      lambda=object[[s]]
    }
    else stop("Invalid form for s")
  predict(object$glmnet.fit,newx,s=lambda,...)
}
<environment: namespace:glmnet>
On Thu, Apr 14, 2011 at 1:14 PM, Kevin Wright <kw.stat at gmail.com> wrote: