On Mon, Sep 26, 2011 at 3:39 PM, Gene Leynes <gley...@gmail.com> wrote: > I don't understand how this function can subset by i when i is missing.... > > ## My function: > myfun = function(vec, i){ > ret = vec[i] > ret > } > > ## My data: > i = 10 > vec = 1:100 > > ## Expected input and behavior: > myfun(vec, i) > > ## Missing an argument, but error is not caught! > ## How is subsetting even possible here??? > myfun(vec) > > > Is there a way to check for missing function arguments, *and* which function > arguments are missing? >
R lets you pass missing arguments down from one function call to another in such a way that they retain their missingness: > f <- function(x) g(x) > g <- function(x) missing(x) > f() [1] TRUE -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.