quad.tree(x, bucket.size=1)
The partitioning algorithm proceeds as follows:
1. Set lower = 1 and upper = nrow (the index of the first and last row in the matrix x). In the following, only consider the rows of x from lower to upper. 2. Compute the range of each column of x over the range of observations from lower to upper. Set icol to the column number with the maximum range. 3. Find the median for column icol, and order the rows in the data matrix x over the range lower to upper such that the median evenly splits the rows. 4. If upper - lower = bucket.size, return. 5. Go to step 2 with lower unchanged and upper set to (upper+lower)/2 (the left child of the tree). 6. Go to step 2 with lower set to (upper+lower)/2 + 1, and upper unchanged (the right child of the tree).
x <- matrix(runif(500),50,10) quad <- quad.tree(x)y <- cbind(sids$easting,sids$northing) sids.quad <- quad.tree(y) sids.quad <- quad.tree(y, bucket.size=5)