[Rd] R-devel's ...names() questions

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Sat May 23 14:29:39 CEST 2020


>>>>> William Dunlap via R-devel 
>>>>>     on Fri, 22 May 2020 11:53:12 -0700 writes:

    > Am am missing something or does the new ...names() in R-devel not work
    > right?

No, you are not missing anything, and you are right.
Thank you for the report!

Martin

    >> a <- function(x, ...) ...names()
    >> a(a=stop("a"), b=stop("b"))
    > [1] "a" ""
    >> a(stop("x"), stop("unnamed"), c=stop("c"), d=stop("d"))
    > [1] NA "" ""

    >> version
    > _
    > platform       x86_64-pc-linux-gnu
    > arch           x86_64
    > os             linux-gnu
    > system         x86_64, linux-gnu
    > status         Under development (unstable)
    > major          4
    > minor          1.0
    > year           2020
    > month          05
    > day            19
    > svn rev        78492
    > language       R
    > version.string R Under development (unstable) (2020-05-19 r78492)
    > nickname       Unsuffered Consequences

    > The following seems to do the right thing
    > alt...names <- function() evalq(names(substitute(...())),
    > envir=parent.frame())

    > However I wonder if it would be better to give the user a function, say
    > ...args_unevaluated(...) to get the unevaluated ... arguments directlly
    > without having to know about the substitute(...()) trick.   Then the user
    > could get the length, the n'th, or the names using the usual length(), [[,
    > and names() functions instead of ...length(), ...elt(), and ...names().

    > Bill Dunlap
    > TIBCO Software
    > wdunlap tibco.com

    > [[alternative HTML version deleted]]

    > ______________________________________________
    > R-devel using r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list