Skip to content
Prev 256920 / 398506 Next

How to see a R code from a package?

On 2011-04-14 12:15, Soyeon Kim wrote:
The code is just where you looked with glmnet:::predict.cv.glmnet.
I suspect that the fact that this function calls another predict
function is what's troubling you. You probably need to learn
a bit about method dispatch in R. The short of it is that
the appropriate predict function needs to be called and this
depends on the type of fitted object you're working with.
glmnet provides 5 different predict functions (see the
help page for predict). If you want to see the individual
predict functions, say predict.coxnet, then do

  predict.coxnet

Ditto for the others. Best would be to download the source
file.

There's nothing being 'protected by the programmer'.

This might also be a good time to check out ?methods.

Peter Ehlers