N <- 100; set.seed(8237)
x <- runif(N); y <- runif(N)
R <- maxempty(c(0,1), c(0,1), x, y)
R
# $area
# [1] 0.08238793
# $rect
# [1] 0.7023670 0.1797339 0.8175771 0.8948442
plot(x, y, pch="+", xlim=c(0,1), ylim=c(0,1), col="darkgray")
do.call(rect, as.list(R$rect))
grid()
Run the code above in your browser using DataLab