[Rd] length of `...`

Mark van der Loo m@rk@v@nderloo @ending from gm@il@com
Thu May 3 16:52:19 CEST 2018


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]]




More information about the R-devel mailing list