Kevin Burnham Kevin Burnham - 1 year ago 88
R Question

Testing equality of two functions in R

Is there a way to determine if the text of two different functions is identical?

x <- function(x) print(x + 2)
y <- function(x) print(x + 2)
identical(x, y)
identical(mget("x"), mget("y"))
identical(unname(mget("x")), unname(mget("y")))

Answer Source

I think this is a good method. It works for many different objects:

[1] TRUE
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download