Skip to content
Back to formatted view

Raw Message

Message-ID: <CAOKDuOjM0HZ+-e++P7J951DpWk4yn1uPO+e+j_N-xLHJmL_Oaw@mail.gmail.com>
Date: 2018-05-03T14:52:19Z
From: Mark van der Loo
Subject: length of `...`
In-Reply-To: <d0b68216-4922-2249-e5e6-1589345dc6d7@kogentum.hu>

This question is better aimed at the r-help mailinglist as it is not about
developing R itself.


having said that,

I can only gues why you want to do this, but why not do something like this:


f <- function(...){
   L <- list(...)
   len <- length()
  # you can stll pass the ... as follows:
  do.call(someotherfunction, L)

}


-Mark

Op do 3 mei 2018 om 16:29 schreef D?nes T?th <toth.denes at kogentum.hu>:

> Hi,
>
>
> In some cases the number of arguments passed as ... must be determined
> inside a function, without evaluating the arguments themselves. I use
> the following construct:
>
> dotlength <- function(...) length(substitute(expression(...))) - 1L
>
> # Usage (returns 3):
> dotlength(1, 4, something = undefined)
>
> How can I define a method for length() which could be called directly on
> `...`? Or is it an intention to extend the base length() function to
> accept ellipses?
>
>
> Regards,
> Denes
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]