Learn R Programming

quadtree (version 0.1.14)

as_vector: Get all Quadtree cell values as a vector

Description

Returns all cell values of a Quadtree as a numeric vector.

Usage

# S4 method for Quadtree
as_vector(x, terminal_only = TRUE)

Value

a numeric vector

Arguments

x

a Quadtree

terminal_only

boolean; if TRUE (the default) only values of terminal cells are returned. If FALSE, all cell values are returned.

See Also

as_data_frame creates a data frame from a Quadtree that has all the cell values as well as details about each cell's size and extent.

Examples

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

qt <- quadtree(habitat, .2)
head(as_vector(qt), 20)
head(as_vector(qt, FALSE), 20)

Run the code above in your browser using DataLab