Skip to content

Is function compiled code or not?

2 messages · Stefan Petersson, Paul Hiemstra

#
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.
#
On 04/08/2011 09:44 AM, Stefan Petersson wrote:
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.:
cheers,
Paul