Re: [Rd] Question on Code snippet semantics

2014-07-21 Thread William Dunlap
subsitute(expr), with only one argument, is only useful inside of a function and then only when the expression, expr, involves an argument to the function. Then the unevaluated actual arguments to the function are substituted into the [unevaluated] expression. E.g., f <- function(x, y=stop("y

Re: [Rd] Question on Code snippet semantics

2014-07-21 Thread Marc Schwartz
On Jul 21, 2014, at 10:07 AM, Mick Jordan wrote: > I came across this code in library.R > > package <- as.character(substitute(package)) > > where package is the first argument to the "library" function. > > I've been racking my brains to understand why this is not just an elaborate > (and i

[Rd] Question on Code snippet semantics

2014-07-21 Thread Mick Jordan
I came across this code in library.R package <- as.character(substitute(package)) where package is the first argument to the "library" function. I've been racking my brains to understand why this is not just an elaborate (and ineffcient) way to write: package <- "package" E.g. > package <-