Permalink
Browse files

Function to capture unevaluated dots

  • Loading branch information...
1 parent 4c26013 commit 8aaa6258771bae205efb43bffd9093cff94f731b @hadley committed Oct 6, 2012
Showing with 18 additions and 0 deletions.
  1. +1 −0 DESCRIPTION
  2. +17 −0 R/utils-functional.r
View
@@ -68,6 +68,7 @@ Collate:
'split-indices.r'
'split.r'
'utils.r'
+ 'utils-functional.r'
'data.r'
'helper-defaults.r'
'helper-revalue.r'
View
@@ -0,0 +1,17 @@
+# f <- function(...) {
+# dots()
+# }
+
+# g <- function() {
+# f <- function(x, y, ...) {
+# dots()
+# }
+# f(x = 1, y = 2, z = 3)
+# }
+dots <- function() {
+ call <- sys.call(-1)
+ def <- eval(call[[1]], parent.frame(2))
+ match.call(def, call, expand.dots = FALSE)$`...`
+}
+
+

0 comments on commit 8aaa625

Please sign in to comment.