forked from ropensci/traits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
133 lines (97 loc) · 3.9 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
traits
=======
```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE
)
```
[![cran checks](https://cranchecks.info/badges/worst/traits)](https://cranchecks.info/pkgs/traits)
[![Build Status](https://travis-ci.org/ropensci/traits.svg?branch=master)](https://travis-ci.org/ropensci/traits)
[![codecov.io](https://codecov.io/github/ropensci/traits/coverage.svg?branch=master)](https://codecov.io/github/ropensci/traits?branch=master)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/traits)](https://github.com/metacran/cranlogs.app)
[![cran version](http://www.r-pkg.org/badges/version/traits)](https://CRAN.R-project.org/package=traits)
R client for various sources of species trait data.
What is a trait? A "trait" for the purposes of this package is broadly defined as an aspect of a species that can be described or measured, such as physical traits (size, length, height, color), behavioral traits (running speed, etc.), and even variables that make up the niche of the species (e.g., habitat).
Included in `traits` with the associated function prefix or function name:
* [BETYdb](http://www.betydb.org) - `betydb_`
* [National Center for Biotechnology Information - NCBI](http://www.ncbi.nlm.nih.gov/) - `ncbi_`
* [Encyclopedia of Life Traitbank](http://eol.org/info/516) - `traitbank_`
* [Coral Traits Database](http://coraltraits.org/) - `coral_`
* [Birdlife International](https://www.birdlife.org/) - `birdlife_`
* LEDA Traitbase - `leda_`
* USDA Plants Database - `tr_usda`
* Zanne et al. plant dataset - `tr_zanne`
* Amniote life history dataset - `tr_ernest`
* More to come ...
Talk to us on the [issues page](https://github.com/ropensci/traits/issues) if you know of a source of traits data with an API, and we'll see about including it.
For an introduction to the package, see [the vignette](vignettes/traits_intro.Rmd).
## Installation
Stable CRAN version
```{r eval=FALSE}
install.packages("traits")
```
Or development version from GitHub
```{r eval=FALSE}
devtools::install_github("ropensci/traits")
```
```{r}
library("traits")
library("dplyr")
```
## BETYdb
Get trait data for Willow (_Salix_ spp.)
```{r}
(salix <- betydb_search("Salix Vcmax"))
# equivalent:
# (out <- betydb_search("willow"))
```
Summarise data from the output `data.frame`
```{r}
library("dplyr")
salix %>%
group_by(scientificname, trait) %>%
mutate(.mean = as.numeric(mean)) %>%
summarise(mean = round(mean(.mean, na.rm = TRUE), 2),
min = round(min(.mean, na.rm = TRUE), 2),
max = round(max(.mean, na.rm = TRUE), 2),
n = length(n))
```
## EOL's traitbank trait data
Searching for _Balaenoptera musculus_ (blue whale), page id `328574`
```{r cache=FALSE}
res <- traitbank(328574)
res$graph %>%
select(`dwc:measurementtype`) %>%
filter(!is.na(`dwc:measurementtype`))
```
## Coral
Get the species list and their ids
```{r cache=FALSE}
coral_species()
```
Get data by taxon
```{r cache=FALSE}
coral_taxa(80)
```
## Birdlife International
Habitat data
```{r}
birdlife_habitat(22721692)
```
## Contributors
* [Scott Chamberlain](https://github.com/ropensci/sckott)
* [Zachary Foster](https://github.com/ropensci/zachary-foster)
* [Ignasi Bartomeus](https://github.com/ropensci/ibartomeus)
* [David LeBauer](https://github.com/ropensci/dlebauer)
* [David Harris](https://github.com/ropensci/davharris)
* [Rupert Collins](https://github.com/ropensci/boopsboops)
## Meta
* Please [report any issues or bugs](https://github.com/ropensci/traits/issues).
* License: MIT
* Get citation information for `traits` in R doing `citation(package = 'traits')`
* Please note that this project is released with a [Contributor Code of Conduct](https://github.com/ropensci/traits/blob/master/CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.
[![ropensci_footer](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org)