Learn R Programming

quadtree: An R package for region quadtrees

quadtree provides functionality for working with raster-like quadtrees (called “region quadtrees”), which allow for variable-sized cells.

library(quadtree)

habitat <- terra::rast(system.file("extdata", "habitat.tif", package="quadtree")) # load sample data
qt <- quadtree(habitat, .03, "sd") # create a quadtree

Installation

The package can be installed from CRAN using install.packages():

install.packages("quadtree")

The development version can be installed from GitHub using devtools::install_github():

# install.packages("devtools")
devtools::install_github("dfriend21/quadtree")

Documentation

Visit the package website for more information.

Learning how to use the quadtree package

The best way to learn about the package is by reading the vignettes, which are available through R and through the package website. I’d suggest reading the vignettes in this order:

  1. Creating Quadtrees
  2. Using Quadtrees
  3. Finding LCPs

Copy Link

Version

Install

install.packages('quadtree')

Monthly Downloads

183

Version

0.1.14

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Derek Friend

Last Published

August 29th, 2023

Functions in quadtree (0.1.14)

plot.LcpFinder

Plot a LcpFinder object
extent

Get the extent of a Quadtree
find_lcp

Find the LCP between two points on a Quadtree
lcp_finder

Create a LcpFinder
n_cells

Get the number of cells in a Quadtree
find_lcps

Find LCPs to surrounding points
copy

Create a deep copy of a Quadtree
plot

Plot a Quadtree
get_neighbors

Get the neighbors of a Quadtree cell
extract

Extract Quadtree values
set_values

Change values of Quadtree cells
projection

Retrieve the projection of a Quadtree
summarize_lcps

Get a matrix summarizing all LCPs found by a LcpFinder
write_quadtree_ptr

Read/write a Quadtree
summary.Quadtree

Show a summary of a Quadtree
transform_values

Transform the values of all Quadtree cells
quadtree-package

Quadtree Representation of Rasters
read_quadtree

Read/write a Quadtree
summary.LcpFinder

Show a summary of a LcpFinder
quadtree

Create a Quadtree from a raster or matrix
CppQuadtree-class

CppQuadtree: C++ quadtree data structure
Quadtree-class

Quadtree class
add_legend

Add a gradient legend to a plot
LcpFinder-class

LcpFinder Class
CppNode-class

CppNode: C++ quadtree node
CppLcpFinder-class

CppLcpFinder: C++ LCP finder
as_sf

Convert to other R spatial objects
as_data_frame

Convert a Quadtree to a data frame
as_raster

Create a raster from a Quadtree
as_vector

Get all Quadtree cell values as a vector