From h@wickh@m @ending from gm@il@com  Thu May  3 17:39:02 2018
From: h@wickh@m @ending from gm@il@com (Hadley Wickham)
Date: Thu, 3 May 2018 08:39:02 -0700
Subject: [Rd] length of `...`
In-Reply-To: <CABdHhvHPxLMAiz5We97R8hixGDOLdrjUEpXwsZ-uW+H+x2jjNw@mail.gmail.com>
References: <d0b68216-4922-2249-e5e6-1589345dc6d7@kogentum.hu>
 <CAOKDuOjM0HZ+-e++P7J951DpWk4yn1uPO+e+j_N-xLHJmL_Oaw@mail.gmail.com>
 <CAMFmJs=+skVenVSFMbQvSDCZofzpESgrvStpOns5m8Ov8tD40g@mail.gmail.com>
 <CABdHhvHPxLMAiz5We97R8hixGDOLdrjUEpXwsZ-uW+H+x2jjNw@mail.gmail.com>
Message-ID: <CABdHhvEdKTt7tJx87Hdv0semK6+MzF3QdpV0Qz71bC7p+PF03A@mail.gmail.com>

On Thu, May 3, 2018 at 8:28 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
> On Thu, May 3, 2018 at 8:00 AM, Gabe Becker <becker.gabe at gene.com> wrote:
>> As of 3.5.0 the ...length() function does exactly what you are asking for.
>> Before that, I don't know of an easy way to get the length without
>> evaluation via R code. There may be one I'm not thinking of though, I
>> haven't needed to do this myself.
>
> dotlength <- function(...) length(nargs())
>
> ?

Oops, I got a bit overzealous there: I mean

dotlength <- function(...) nargs()

(This is subtly different from calling nargs() directly as it will
only count the elements in ...)

Hadley

-- 
http://hadley.nz




[Rd] length of `...`
Hadley Wickham