Is function compiled code or not?
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