> On 6 Oct 2020, at 09:22 , Dénes Tóth <toth.de...@kogentum.hu> wrote:
>
> > foo <- function(...) substitute({...()})
> > foo(abc$de, fg[h], i)
> {
> pairlist(abc$de, fg[h], i)
> }
> > foo(abc$de, fg[h], , i) # add a missing argument for extra fun
> {
> as.pairlist(alist(abc$de, fg[h], , i))
> }
>
The 2nd one here is actually an artifact of deparse(). The result is still a
pairlist, just one that pairlist(....) cannot reproduce:
> e <- foo(abc$de, fg[h], , i)
> e[[2]]
[[1]]
abc$de
[[2]]
fg[h]
[[3]]
[[4]]
i
> deparse(e[[2]])
[1] "as.pairlist(alist(abc$de, fg[h], , i))"
> dput(e[[2]])
as.pairlist(alist(abc$de, fg[h], , i))
> mode(e[[2]])
[1] "pairlist"
> mode(e[[2]][[3]])
[1] "name"
I.e. the list in e[2] contains the missing indicator (an empty name). (I'm
slightly puzzled why we need the curlies to trigger a deparse, though)
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd....@cbs.dk Priv: pda...@gmail.com
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.