[R] R-source code of a function

Duncan Murdoch murdoch at stats.uwo.ca
Wed Jul 16 15:00:34 CEST 2008


On 7/16/2008 8:29 AM, arezoo bagheri wrote:
> Hi,
> I know that if i want to see the SPLUS or R-source code of a function,i should give the command 
> without the brackets.For example:
>  rsquared.lmRobMM
> function(x)
> {
>  str0 <- "Initial S-estimate"
>  str1 <- "Final M-estimate"
>  if(x$est == "final") {
>   z <- x$r.squared
>   attr(z, "info") <- str1
>  }
>  if(x$est == "initial") {
>   z <- x$r.squared
>   attr(z, "info") <- str0
>  }
>  oldClass(z) <- "lmRobMM.info"
>  z
> }
>> 
> Is there anybody knows how can i  access all linked code which maybe written in the other languages such as c in above program?

There is no linked C in the example above:  it would be called using 
.C() or a few other related functions.

But if you see one of those in some other function, you'll want to 
follow Uwe Ligge's advice in RNews on locating the source.  His article 
is online here: http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf, on 
page 43-45.

Duncan Murdoch



More information about the R-help mailing list