You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.Rmd
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,16 @@ library(devtools)
39
39
install_github("kmartinet/ssarp")
40
40
```
41
41
42
+
## Suppressing Messages
43
+
44
+
To suppress all messages output by *ssarp*, run
45
+
46
+
```r
47
+
options(ssarp.silent=TRUE)
48
+
```
49
+
50
+
before using any of *ssarp*'s functions.
51
+
42
52
## Example: Creating a Species-Area Relationship
43
53
44
54
A species-area relationship (SAR) visualizes the relationship between species richness (the number of species) and the area of the land mass on which the species live. This brief example covers the *ssarp* workflow for creating a SAR, and more detailed explanations of the code and methods can be found [in the Articles on the ssarp pkgdown website](https://kmartinet.github.io/ssarp/index.html).
Copy file name to clipboardExpand all lines: README.md
+70-12Lines changed: 70 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -261,23 +261,81 @@ statistical information about the model.
261
261
262
262
### Workflow Summary for using data from GBIF to create a species-area relationship plot
263
263
264
-
1. Use `rgbif` to gather occurrence records, or input your own dataframe of occurrence records.
265
-
2. Use `find_land(occ, fillgaps)` with the dataframe obtained in Step 1 to figure out the names of landmasses using the occurrence record GPS points and the [*maps* R package](https://cran.r-project.org/web/packages/maps/index.html). Setting the "fillgaps" parameter to `TRUE` will enable the use of [Photon API](https://photon.komoot.io/) to fill in any missing landmass names left by the *maps* R package.
266
-
3. Use `find_areas(occ, area_custom)` with the dataframe obtained in Step 2 to match the landmass names to a dataset that includes names of most islands on the planet and their areas. If the user would like to use a custom island area dataset instead of the built-in one, the "area_custom" parameter can be set to the name of the custom island area dataframe.
267
-
3a. If you'd like to only include occurrence records from islands, you can remove continental records by using `remove_continents(occ)` with the dataframe returned by `find_areas()`
268
-
5. Use `create_SAR(occ, npsi)` with the dataframe obtained in Step 3 to create a species-area relationship plot that reports information important to the associated regression. The "npsi" parameter indicates the maximum number of breakpoints the user would like to compare for model selection. The returned model and plot correspond with the best-fit model.
264
+
1. Use `rgbif` to gather occurrence records, or input your own dataframe of
265
+
occurrence records.
266
+
2. Use `find_land(occ, fillgaps)` with the dataframe obtained in Step 1 to
267
+
figure out the names of landmasses using the occurrence record GPS points and
268
+
the [*maps* R package](https://cran.r-project.org/web/packages/maps/index.html).
269
+
Setting the "fillgaps" parameter to `TRUE` will enable the use of
270
+
[Photon API](https://photon.komoot.io/) to fill in any missing landmass names
271
+
left by the *maps* R package.
272
+
3. Use `find_areas(occ, area_custom)` with the dataframe obtained in Step 2 to
273
+
match the landmass names to a dataset that includes names of most islands on
274
+
the planet and their areas. If the user would like to use a custom island area
275
+
dataset instead of the built-in one, the "area_custom" parameter can be set to
276
+
the name of the custom island area dataframe.
277
+
3a. If you'd like to only include occurrence records from islands, you can
278
+
remove continental records by using `remove_continents(occ)` with the dataframe
279
+
returned by `find_areas()`
280
+
4. Use `create_SAR(occ, npsi)` with the dataframe obtained in Step 3 to create
281
+
a species-area relationship plot that reports information important to the
282
+
associated regression. The "npsi" parameter indicates the maximum number of
283
+
breakpoints the user would like to compare for model selection. The returned
284
+
model and plot correspond with the best-fit model.
269
285
270
286
### Workflow summary for using data from GBIF and a user-provided phylogenetic tree to create a speciation-area relationship plot
271
287
272
-
1. Use `rgbif` to gather occurrence records, or input your own dataframe of occurrence records.
273
-
2. Use `find_land(occ, fillgaps)` with the dataframe obtained in Step 1 to figure out the names of landmasses using the occurrence record GPS points and the [*maps* R package](https://cran.r-project.org/web/packages/maps/index.html). Setting the "fillgaps" parameter to `TRUE` will enable the use of [Photon API](https://photon.komoot.io/) to fill in any missing landmass names left by the *maps* R package.
274
-
3. Use `find_areas(occ, area_custom)` with the dataframe obtained in Step 2 to match the landmass names to a dataset that includes names of most islands on the planet and their areas. If the user would like to use a custom island area dataset instead of the built-in one, the "area_custom" parameter can be set to the name of the custom island area dataframe.
275
-
3a. If you'd like to only include occurrence records from islands, you can remove continental records by using `remove_continents(occ)` with the dataframe returned by `find_areas()`
276
-
4. Use either `estimate_DR(tree, label_type, occ)` or `estimate_MS(tree, label_type, occ)` with your own phylogenetic tree that corresponds with the taxa signified in previous steps, a classifier that describes your tip labels (whether the tip labels are simply species epithets or full scientific names), and the dataframe obtained in Step 3 to add tip speciation rates using the DR statistic (Jetz et al. 2012) or the lambda calculation for crown groups from Magallόn and Sanderson (2001) respectively to the occurrence dataframe. The user may also choose to estimate tip speciation rates from a BAMM analysis (Rabosky 2014) by using `estimate_BAMM(label_type, occ, edata)` with a classifier that describes your tip labels (whether the tip labels are simply species epithets or full scientific names), the occurrence record dataframe obtained in Step 3, and a bammdata object generated by reading the event data file from a BAMM analysis with the *BAMMtools* package (Rabosky et al. 2014).
277
-
5. Use `create_SpAR(occ, npsi)` with the dataframe obtained in Step 4 to create a speciation-area relationship plot that reports information important to the associated regression. The "npsi" parameter indicates the maximum number of breakpoints the user would like to compare for model selection. The returned model and plot correspond with the best-fit model.
288
+
1. Use `rgbif` to gather occurrence records, or input your own dataframe of
289
+
occurrence records.
290
+
2. Use `find_land(occ, fillgaps)` with the dataframe obtained in Step 1 to
291
+
figure out the names of landmasses using the occurrence record GPS points and
292
+
the [*maps* R package](https://cran.r-project.org/web/packages/maps/index.html).
293
+
Setting the "fillgaps" parameter to `TRUE` will enable the use of
294
+
[Photon API](https://photon.komoot.io/) to fill in any missing landmass names
295
+
left by the *maps* R package.
296
+
3. Use `find_areas(occ, area_custom)` with the dataframe obtained in Step 2 to
297
+
match the landmass names to a dataset that includes names of most islands on
298
+
the planet and their areas. If the user would like to use a custom island area
299
+
dataset instead of the built-in one, the "area_custom" parameter can be set to
300
+
the name of the custom island area dataframe.
301
+
3a. If you'd like to only include occurrence records from islands, you can
302
+
remove continental records by using `remove_continents(occ)` with the dataframe
303
+
returned by `find_areas()`
304
+
4. Use either `estimate_DR(tree, label_type, occ)` or
305
+
`estimate_MS(tree, label_type, occ)` with your own phylogenetic tree that
306
+
corresponds with the taxa signified in previous steps, a classifier that
307
+
describes your tip labels (whether the tip labels are simply species epithets
308
+
or full scientific names), and the dataframe obtained in Step 3 to add tip
309
+
speciation rates using the DR statistic (Jetz et al. 2012) or the lambda
310
+
calculation for crown groups from Magallόn and Sanderson (2001) respectively
311
+
to the occurrence dataframe. The user may also choose to estimate tip
312
+
speciation rates from a BAMM analysis (Rabosky 2014) by using
313
+
`estimate_BAMM(label_type, occ, edata)` with a classifier that describes your
314
+
tip labels (whether the tip labels are simply species epithets or full
315
+
scientific names), the occurrence record dataframe obtained in Step 3, and a
316
+
bammdata object generated by reading the event data file from a BAMM analysis
317
+
with the *BAMMtools* package (Rabosky et al. 2014).
318
+
5. Use `create_SpAR(occ, npsi)` with the dataframe obtained in Step 4 to create
319
+
a speciation-area relationship plot that reports information important to the
320
+
associated regression. The "npsi" parameter indicates the maximum number of
321
+
breakpoints the user would like to compare for model selection. The returned
322
+
model and plot correspond with the best-fit model.
278
323
279
324
### Some helpful notes about well-known text (WKT) representation of geometry
280
-
When running `getData()`, the user can specify a well-known text (WKT) representation of geometry to restrict the geographic location of the returned occurrence records. The rgbif::occ_search function that `getData()` calls requires a counter-clockwise winding order for WKT. I find it helpful to think about WKT polygons in this way: imagine a square around your geographic area of interest and pick one of the corners as a starting point. The order of points in WKT format should follow counter-clockwise from the corner you picked first, and the final entry in the WKT string needs to be the same as the first entry. Additionally, while GPS points are typically represented in "latitude, longitude" format, WKT expects them in "longitude latitude" format with commas separating the points rather than individual longitude and latitude values. WKT polygons can have more specified points than included in this simple square example, and even include polygons nested within others or polygons with holes in the middle.
325
+
When running `getData()`, the user can specify a well-known text (WKT)
326
+
representation of geometry to restrict the geographic location of the returned
327
+
occurrence records. The rgbif::occ_search function that `getData()` calls
328
+
requires a counter-clockwise winding order for WKT. I find it helpful to think
329
+
about WKT polygons in this way: imagine a square around your geographic area of
330
+
interest and pick one of the corners as a starting point. The order of points
331
+
in WKT format should follow counter-clockwise from the corner you picked first,
332
+
and the final entry in the WKT string needs to be the same as the first entry.
333
+
Additionally, while GPS points are typically represented in "latitude,
334
+
longitude" format, WKT expects them in "longitude latitude" format with commas
335
+
separating the points rather than individual longitude and latitude values.
336
+
WKT polygons can have more specified points than included in this simple square
337
+
example, and even include polygons nested within others or polygons with holes
0 commit comments