How can we parse the dots-arguments in a function?
dots <- function(...){
  # was cex in the dots-args? parse dots.arguments
  cex <- unlist(match.call(expand.dots=FALSE)$...["cex"])
  if(is.null(cex)) print("No cex supplied")
  else print(gettextf("cex was %s", cex))
}
dots (cex=0.9, another=4)
dots (another=5)
 ->
Samstag, 17. November 2012
Abonnieren
Kommentare (Atom)