-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
61 lines (43 loc) · 2.82 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
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = ">",
fig.path = "tools/README-",
fig.align = 'center',
fig.show = 'hold'
)
```
# linbin
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/linbin)](https://cran.r-project.org/package=linbin)
![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/linbin)
Short for "linear binning", linbin is an [R](https://www.r-project.org/) package for manipulating, binning, and plotting linearly referenced data. Although developed for data collected on river networks, it can be used with any interval or point data referenced to a 1-dimensional coordinate system. Flexible bin generation and batch processing makes it easy to compute and visualize variables at multiple scales, useful for identifying patterns within and between variables and investigating the influence of scale of observation on data interpretation.
To install in R:
* the latest released version: `install.packages("linbin")`
* the latest development version: [devtools](https://github.com/r-lib/devtools)::`install_github("ezwelty/linbin")`
Find out more by reading the illustrated [introduction](https://CRAN.R-project.org/package=linbin/vignettes/introduction.html) and [examples](https://CRAN.R-project.org/package=linbin/vignettes/examples.html) vignettes. For detailed function and dataset documentation, see the [reference manual](https://CRAN.R-project.org/package=linbin/linbin.pdf). For the application of linbin to the study of stream fishes, see the original [journal article](https://doi.org/10.1080/02755947.2015.1044764):
_Ethan Z. Welty, Christian E. Torgersen, Samuel J. Brenkman, Jeffrey J. Duda, Jonathan B. Armstrong (2015). Multiscale analysis of river networks using the R package linbin. North American Journal of Fisheries Management, 35(4):802–809. doi: [10.1080/02755947.2015.1044764](https://doi.org/10.1080/02755947.2015.1044764)_
### ...
```{r, echo = FALSE}
library(linbin)
```
```{r, echo = FALSE, fig.width = 7, fig.height = 6}
# Load event data
e <- quinault
# Design bins
bin.lengths <- c(100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600) # m
bins <- seq_events(event_range(e), by = bin.lengths / 1000) # km
# Sample events at bins
e.bins <- sample_events(e, bins, list(sum, "ONXX.*"), scaled.cols = "ONXX.*")
# Plot binned data
plot_events(e.bins, group.col = "group", data.cols = "ONXX.total",
main = paste0("Bin length = ", prettyNum(bin.lengths, ","), " m"),
xlabs = "Distance upstream (km)", ylabs = "Trout abundance",
dim = c(3, 3), byrow = TRUE, oma = c(3, 3, 2, 2))
```
> *Longitudinal profiles of trout abundance throughout the Quinault River, Washington, USA plotted at a range of bin lengths.*