[Rd] [ on call

Mick Jordan mick.jordan at oracle.com
Wed Jul 8 00:33:24 CEST 2015

I'm rather puzzled by this behavior:

export("caption<-", "caption", "label", "label<-", "align<-",
     "align", "digits<-", "digits", "display<-", "display", "xtable",
     "print.xtable", "toLatex.xtable")
 > e[[1L]]
 > e[-1L]
"caption<-"("caption", "label", "label<-", "align<-", "align",
     "digits<-", "digits", "display<-", "display", "xtable", 

I'm not at all clear what should result from removing the first element, 
i.e. the 'export', but I would not expect the first argument to be 
promoted into the function position. I guess I would expect a coercion 
to list or pairlist first, after which the [-1L] would produce a 
meaningful result on that coercion. In any event I do observe that 
as.character(e[-1L]) produces the expected result:

  [1] "caption<-"      "caption"        "label" "label<-"
  [5] "align<-"        "align"          "digits<-" "digits"
  [9] "display<-"      "display"        "xtable" "print.xtable"
[13] "toLatex.xtable"

This code is from parseNamespaceFile (on the xtable package).

Mick Jordan

More information about the R-devel mailing list