Suraj
Suraj

Reputation: 36587

Test that two function variables point to the same function?

How can I test that two function variables point to the same function?

test = lm
test2 = lm

test == lm     # error: comparison (1) is possible only for atomic and list types
test == test2  # error: comparison (1) is possible only for atomic and list types

Upvotes: 4

Views: 1380

Answers (1)

kohske
kohske

Reputation: 66872

Try:

identical(test, lm)
identical(test, test2)

Upvotes: 7

Related Questions