From hb at biostat.ucsf.edu  Fri Jan  3 02:16:25 2014
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Thu, 2 Jan 2014 17:16:25 -0800
Subject: [Rd] class() on substitute(...) output?
Message-ID: <CAFDcVCS7vdmRdnqYQvb3xq5C5x7+366b_SPisQeb9oX7vWHKRw@mail.gmail.com>

Does it make sense to talk about the class of the output of
substitute(...)?  I'm puzzled by the following outputs:

ee <- list(
  A = substitute( a <- 1 ),
  B = substitute({ a <- 1 }),
  C = substitute(( a <- 1 )),
  D = substitute( a == 1 )
)

> t(sapply(ee, FUN=function(e) { c(typeof=typeof(e), mode=mode(e), class=class(e)) }))
  typeof     mode   class
A "language" "call" "<-"
B "language" "call" "{"
C "language" "("    "("
D "language" "call" "call"

That the mode in C is "(", is motivated in help("mode"): "that some
calls have mode "(" which is S compatible."  However, what's the
explanation for the different classes?  Is that intended or just
"garbage" output?

Thanks,

Henrik



[Rd] class() on substitute(...) output?
Henrik Bengtsson