-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
92 lines (69 loc) · 2.29 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
title: "The unified neutral theory of biodiversity: the untb package"
output:
github_document:
pandoc_args: --webtex
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
<img src="man/figures/untb.png" width = "150" align="right" />
<!-- badges: start -->
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/untb)](https://cran.r-project.org/package=untb)
<!-- badges: end -->
The `untb` package provides R-centric functionality for working with
Hubbell's unified neutral theory of biogeography and biodiversity. A
vignette is provided in the package. The canonical reference is
Hubbell 2001; to cite the package in publications please use Hankin
2007.
# Installation
You can install the released version of the `untb` package from
[CRAN](https://CRAN.R-project.org) with:
```{r, label=installthepackage,message=FALSE}
# install.packages("untb") # uncomment this to install the package
library("untb")
set.seed(0)
```
# The `untb` package in use
The package has two main classes, `count` and `census`. A `count`
object is a named integer vector, with names being species and entries
being respective counts. Thus:
```{r cliff1}
x <- count(c(cats=9,pigs=3,dogs=2,rats=1,hogs=1,bats=1))
x
summary(x)
```
Above, we see 9 cats, 3 pigs, and so on. Function `summary()` gives
further information. A `census` object is an unordered factor with
entries being the species of each individual:
```{r coercetocensus}
as.census(x)
```
The package includes example datasets:
```{r showsummarysahfos}
data(sahfos)
summary(sahfos)
```
We can give a visual summary of a dataset in two ways:
```{r prestonplotsahfos}
plot(sahfos)
plot(preston(sahfos))
```
The package also includes the ability to generate random neutral
assemblages:
```{r showrandomassemblage}
summary(rand.neutral(1000,10))
summary(rand.neutral(1000,10))
```
## References
* S. P. Hubbell 2001. "The Unified Neutral Theory of Biodiversity and
Biogeography", Princeton University Press.
* R. K. S. Hankin, 2007. "Introducing untb, an R package for
simulating ecological drift under the unified nuetral theory of
biodiversity", _Journal of Statistical Software_ 22(12)