How to compare functions?

后端 未结 3 425
醉酒成梦
醉酒成梦 2020-11-29 12:00

Is there a way to compare whether two function objects are the same?

m <- mean
m == mean ## don\'t work

## this seems not to be the correct way:
function         


        
3条回答
  •  [愿得一人]
    2020-11-29 12:51

    I use isTRUE(all.equal(function1,function2)), but this suffers from similar drawbacks to the other methods.

    Interestingly though, all.equal gives a nice summary of how the two operands differ (try all.equal(function1,function2).

提交回复
热议问题