-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
77 lines (55 loc) · 2.23 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(terra)
library(badger)
```
# `quadtree`: An R package for region quadtrees
<!-- badges: start -->
```{r, echo = FALSE, results='asis'}
cat(
badge_cran_release("quadtree", "green"),
badge_devel("dfriend21/quadtree", "blue")
)
```
<!-- badges: end -->
`quadtree` provides functionality for working with raster-like quadtrees (called "region quadtrees"), which allow for variable-sized cells.
```{r example_create, message = FALSE}
library(quadtree)
habitat <- terra::rast(system.file("extdata", "habitat.tif", package="quadtree")) # load sample data
qt <- quadtree(habitat, .03, "sd") # create a quadtree
```
```{r example_plot, echo=FALSE, fig.width=10, fig.height=5, out.width="100%", dev="png"}
par(mfrow = c(1, 2), mar = c(1, 1, 3, 3))
plot(habitat, zlim = c(0, 1), main = "raster representation", axes = FALSE,
box = FALSE)
plot(habitat, main = "quadtree representation", axes = FALSE, box = FALSE,
col = "transparent", legend = FALSE)
plot(qt, add = TRUE, na_col = NULL, border_lwd = .3, legend = FALSE,
zlim = c(0, 1))
```
## Installation
The package can be installed from CRAN using `install.packages()`:
``` r
install.packages("quadtree")
```
The development version can be installed from GitHub using `devtools::install_github()`:
``` r
# install.packages("devtools")
devtools::install_github("dfriend21/quadtree")
```
## Documentation
Visit the [package website](https://dfriend21.github.io/quadtree/index.html) 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](https://dfriend21.github.io/quadtree/index.html). I'd suggest reading the vignettes in this order:
1. [Creating Quadtrees](https://dfriend21.github.io/quadtree/articles/quadtree-creation.html)
2. [Using Quadtrees](https://dfriend21.github.io/quadtree/articles/quadtree-usage.html)
3. [Finding LCPs](https://dfriend21.github.io/quadtree/articles/quadtree-lcp.html)