read_quadtree {quadtree} | R Documentation |
Read/write a Quadtree
Description
Reads and writes a Quadtree
.
Usage
## S4 method for signature 'character'
read_quadtree(x)
## S4 method for signature 'character,Quadtree'
write_quadtree(x, y)
Arguments
x |
character; the filepath to read from or write to |
y |
a |
Details
To read/write a quadtree object, the C++ library cereal
is used to
serialize the quadtree and save it to a file. The file extension is
unimportant - it can be anything (I've been using the extension '.qtree').
Value
read_quadtree()
- returns a Quadtree
write_quadtree()
- no return value
Examples
library(quadtree)
habitat <- terra::rast(system.file("extdata", "habitat.tif", package="quadtree"))
qt <- quadtree(habitat, .1)
path <- tempfile(fileext = "qtree")
write_quadtree(path, qt)
qt2 <- read_quadtree(path)
[Package quadtree version 0.1.14 Index]