> See the above example. Is there a way to make 'drop=FALSE' as global > default, so that when I say 'tmp[,1]', R will treat it as > 'tmp[,1,drop=FALSE]'?
The following code won't change the defaults, but it would at least let you know when you're making the mistake: trace_all <- function(fs, tracer) { lapply(fs, trace, exit = tracer, print=FALSE) invisible() } functions_with_arg <- function(arg, pos) { fs <- ls(pos=pos) present <- unlist(lapply(fs, function(x) is.function(get(x)) && !is.null(formals(x)[[arg]]))) fs[present] } trace_all( functions_with_arg("drop", "package:base"), quote(if (drop) warning("drop = TRUE", call. = F)) ) > mtcars[1, 2] [1] 6 Warning message: drop = TRUE Unfortunately it doesn't pick up on the generic [ because it is a primitive. Hadley -- http://had.co.nz/ ______________________________________________ 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.