Hi, I tried to pass the function dist() as an argument, but got an error 
message. However, almost the same code with mean() as the function to be passed, 
it works ok.

foo<-function (x,
    xfun = dist) 
{
 xfun(x)
}

foo(matrix(1:100,nrow=5))
Error in foo(matrix(1:100, nrow = 5)) : could not find function "xfun"


foo<-function (x,
     xfun = mean) 
 {
  xfun(x)
 }
 
foo(1:10)
[1] 5.5

what am I missing here?

Thanks

John

	[[alternative HTML version deleted]]

