Binding basics
- Create values and bind a name to them
- Names have values (rather than values have names)
- Multiple names can refer to the same values
- We can look at an object’s address to keep track of the values independent of their names
Exercises
1. Explain the relationships
a
b
andc
are all names that refer to the first value1:10
d
is a name that refers to the second value of1:10
.
2. Do the following all point to the same underlying function object? hint: lobstr::obj_addr()
obj_addr(mean)
#> [1] "0x557c28147ba0"
obj_addr(base::mean)
#> [1] "0x557c28147ba0"
obj_addr(get("mean"))
#> [1] "0x557c28147ba0"
obj_addr(evalq(mean))
#> [1] "0x557c28147ba0"
obj_addr(match.fun("mean"))
#> [1] "0x557c28147ba0"
Yes!