R: Quote vs Substitute
What is the difference between the following 2 code blocks, even though they produce the same output? If you are not sure, this post will help you. rm(list=ls()) x <- 1:1e8 g <- function(a){ b <- substitute(a) print(eval(b)) print(eval(b)) } g(mean(x)) [1] 5e+07 [1] 5e+07 rm(list=ls()) x <- 1:1e8 g <- function(a){ b <- quote(a) print(eval(b)) print(eval(b)) } g(mean(x)) [1] 5e+07 [1] 5e+07 One of the really (really) cool features of R is the idea of Non Standard Evaluation....