Re: [R] How to see a R code from a package?

From: Steve Lianoglou <mailinglist.honeypot_at_gmail.com>
Date: Thu, 14 Apr 2011 13:30:57 -0400

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:
> See help for getAnywhere()
>
> Kevin
>
>
> On Thu, Apr 14, 2011 at 11:24 AM, Soyeon Kim <yunni0731_at_gmail.com> wrote:
>
>> Dear R users,
>>
>> Hi. I want know R code of a function: predict.cv.glmnet (which is
>> included in glmnet package).
>> Could you let me know how I can see the R code of the function?
>>
>> Thank you,
>> Soyeon Kim
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 14 Apr 2011 - 17:36:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Apr 2011 - 17:50:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive