Is there a case to be made for this? If so, where is it? (I don't find x[lower.tri(x)] harder to write than lower.tri(x, value=TRUE), and wonder why you do? For grep, one can argue that handling empty sets is clearer with value=, but I have seen quite a few uses where that is not used and could have been.)
On Sat, 5 Aug 2006, Patrick Burns wrote: > I propose that a 'value' argument be added to > 'lower.tri' and 'upper.tri'. This is analogous to > the 'value' argument of 'grep'. > > Something like the following should work: > > > upper.tri > function (x, diag = FALSE, value = FALSE) > { > x <- as.matrix(x) > if (diag) > ans <- row(x) <= col(x) > else ans <- row(x) < col(x) > if(value) x[ans] else ans > } > <environment: namespace:base> -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel