Re: [R] Is function compiled code or not?

From: Paul Hiemstra <paul.hiemstra_at_knmi.nl>
Date: Fri, 08 Apr 2011 11:22:35 +0200

On 04/08/2011 09:44 AM, Stefan Petersson wrote:
> Hi,
>
> Sorry for my ignorance, but how can I see if a function is 'compiled code' or plain R? E.g. the daisy
> function from the cluster package.
>
> ______________________________________________
> 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.
Hi,

Look at the sources of the function and look for .C or .Fortran. In the case of daisy there is a call to a fortran routine:

   disv <- .Fortran(cl_daisy, n, p, x, if (mdata) valmd else double(1),

        as.double(weights), if (mdata) jtmd else integer(1),
        jdat, type3, ndyst, as.integer(mdata), dis = double((n *
            (n - 1))/2), NAOK = TRUE, DUP = FALSE)$dis

An easy way to look at sources is to type the command at the command line without the parentheses, e.g.:

> daisy

cheers,
Paul

-- 
Paul Hiemstra, MSc
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770

______________________________________________
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 Fri 08 Apr 2011 - 10:53:05 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 Fri 08 Apr 2011 - 11:00:28 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