Dear all, Does R offer a means by which a function can determine whether its return value is assigned? I am using R 2.4.1 for Windows.
Suppose what I am looking for is called "return.value.assigned". Then one might use it like this myfunction <- function () { # Create bigobject here if (return.value.assigned()) { bigobject } else { summary(bigobject) } } and x <- myfunction() # bigobject is assigned myfunction() # summary of bigobject is printed Octave and MATLAB have the nargout function that does what I want, and Perl has the wantarray function detecting the context in which a function is called. Perhaps match.call() can be made to do what I want, but, if so, I don't see it in reading the documentation. Sincerely, Paul Laub ______________________________________________ R-help@stat.math.ethz.ch 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.