n_cells: Get the number of cells in a 'Quadtree'

n_cellsR Documentation

Get the number of cells in a Quadtree

Description

Returns the number of nodes/cells in the quadtree.

Usage

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

Arguments

x

a Quadtree

terminal_only

boolean; if TRUE (the default) only the terminal nodes are counted. If FALSE, all nodes are counted, thereby giving the total number of nodes in the tree.

Value

a numeric

Examples

library(quadtree)
habitat <- terra::rast(system.file("extdata", "habitat.tif", package="quadtree"))

qt <- quadtree(habitat, .1)
n_cells(qt)
n_cells(qt, terminal_only = FALSE)

quadtree documentation built on Aug. 29, 2023, 5:11 p.m.