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
Enregistrer un commentaire