as_data_frame {quadtree}R Documentation

Convert a Quadtree to a data frame

Description

Creates a data frame with information on each quadtree cell.

Usage

## S4 method for signature 'Quadtree'
as_data_frame(x, terminal_only = TRUE)

Arguments

x

a Quadtree

terminal_only

boolean; if TRUE (the default) only information on terminal cells is returned. If FALSE, information on all cells is returned.

Value

A data frame with one row for each quadtree cell. The columns are as follows:

See Also

as_vector() returns all the cell values as a numeric vector.

Examples

library(quadtree)

mat <- rbind(c(1, 1, 0, 1),
             c(1, 1, 1, 0),
             c(1, 0, 1, 1),
             c(0, 1, 1, 1))
qt <- quadtree(mat, .1)
plot(qt)
as_data_frame(qt)

[Package quadtree version 0.1.14 Index]