Description Usage Arguments Value Examples
Hashes a function, but considering the formals and body, thus the resulting has is influenced by changes to signature and implementation.
1 2 | ## S3 method for class ''function''
hash(value)
|
value |
value to hash |
hashed value as a string
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | my.function <- function (x, y) x+y
# a list of values to hash
values <- list(
"Hello world!",
101,
3.142,
TRUE,
my.function,
(function (x, y) x+y),
functionCall(my.function, call("my.function", 10, 10)),
list(a=1, b=2, c="hello")
)
# hash the values in the list
(hashes <- lapply(values, hash))
# Note that functions with the same body will have the same hash
hashes[[5]] == hashes[[6]]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.