Read the ... parameter

The best practice is to use list(...) to read the parameters transmitted through ... It will return a list.

Examples:

> es <- function(...) {str(list(...))}
> es()
list()
> es(1)
List of 1
$ : num 1
> es(c(1, 2))
List of 1
$ : num [1:2] 1 2
> es(r=3, c(1, 2))
List of 2
$ r: num 3
$  : num [1:2] 1 2
> es(las=1, xlim=c(1,2))
List of 2
$ las : num 1
$ xlim: num [1:2] 1 2

If you want read the ... both within a function and in interactive mode for example for debugging:

troispoints <- tryCatch(list(...), error=function(e) list())

Commentaires

Posts les plus consultés de ce blog

Standard error from Hessian Matrix... what can be done when problem occurs

stepAIC from package MASS with AICc

Install treemix in ubuntu 20.04