由于%>;%运算符的工作方式,这两个函数不会产生相同的输出,但我不明白为什么?
my_function <- function(x) {
# Extract the name of x
the_name_of_x <- deparse(substitute(x))
print(the_name_of_x)
}
my_other_function <- function(x) {
# Extract the name of x
the_name_of_x <- x %>% substitute() %>% deparse()
print(the_name_of_x)
}
# Example
my_function("zaza")
# [1] "\"zaza\""
my_other_function("zaza")
# [1] "x"
我真的不明白这有什么不同.