Skip to content

function in argument

4 messages · David Winsemius, array chip, Henrique Dallazuanna

#
On Apr 1, 2011, at 5:56 PM, array chip wrote:

            
Works on my machine.

 > foo(matrix(1:100,nrow=5))
           1         2         3         4
2  4.472136
3  8.944272  4.472136
4 13.416408  8.944272  4.472136
5 17.888544 13.416408  8.944272  4.472136


You have probably overwritten `dist` with a non-functional object.

Try rm(dist) and re-run:
Thinking about your full workspace, I would guess.

--

David Winsemius, MD
West Hartford, CT
#
Or:

foo<-function (x, xfun = dist) {
    match.fun(xfun)(x)
}
On Fri, Apr 1, 2011 at 7:06 PM, array chip <arrayprofile at yahoo.com> wrote: