Skip to content

Commit

Permalink
version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBeal authored and cran-robot committed Apr 26, 2022
1 parent d41e51d commit ba4dc02
Show file tree
Hide file tree
Showing 21 changed files with 742 additions and 338 deletions.
22 changes: 11 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: track2KBA
Title: Identifying Important Areas from Animal Tracking Data
Version: 1.0.1
Version: 1.0.2
Authors@R: c(
person("Martin", "Beal", email = "martinbeal88@gmail.com", role = "cre", comment = c(ORCID = "0000-0003-1654-1410")),
person("Martin", "Beal", email = "martinbeal88@gmail.com", role = c("aut","cre"), comment = c(ORCID = "0000-0003-1654-1410")),
person("Steffen", "Oppel", email = "steffen.oppel@gmail.com", role = "aut", comment = c(ORCID = "0000-0003-1654-1410")),
person("Maria", "Dias", email = "maria.dias@birdlife.org", role = "aut", comment = c(ORCID = "0000-0002-7281-4391")),
person("Mark", "Miller", email = "mark.gr.miller@gmail.com", role = "ctb"),
Expand All @@ -17,23 +17,23 @@ Description: Functions for preparing and analyzing animal tracking data,
the population level and therefore of conservation interest. Areas identified
using this package may be checked against global or regionally-defined criteria,
such as those set by the Key Biodiversity Area program. The method
published herein is an optimized and updated version of the method described in Lascelles
et al. 2016 <doi:10.1111/ddi.12411>.
published herein is described in full in Beal et al. 2021 <doi:10.1111/2041-210X.13713>.
Depends: R (>= 2.10)
License: LGPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
BugReports: https://github.com/BirdLifeInternational/track2kba/issues
Suggests: adehabitatLT, doParallel, knitr, maps, Matching, move,
parallel, rmarkdown, tinytest, rgeos, rgdal (>= 1.5-0)
Suggests: adehabitatLT, doParallel, knitr, parallel, rmarkdown,
tinytest
VignetteBuilder: knitr
Imports: adehabitatHR, dplyr, foreach, geosphere, ggplot2, lubridate,
magrittr, maptools, methods, purrr, raster, rlang, sf (>=
0.7-4), sp (>= 1.4-1), tidyr
magrittr, maps, maptools, Matching, methods, move, purrr,
raster, rgdal (>= 1.5-0), rgeos, rlang, sf (>= 0.7-4), sp (>=
1.4-1), tidyr
NeedsCompilation: no
Packaged: 2021-08-07 15:19:36 UTC; Martim Bill
Author: Martin Beal [cre] (<https://orcid.org/0000-0003-1654-1410>),
Packaged: 2022-04-26 14:58:38 UTC; Martim Bill
Author: Martin Beal [aut, cre] (<https://orcid.org/0000-0003-1654-1410>),
Steffen Oppel [aut] (<https://orcid.org/0000-0003-1654-1410>),
Maria Dias [aut] (<https://orcid.org/0000-0002-7281-4391>),
Mark Miller [ctb],
Expand All @@ -44,4 +44,4 @@ Author: Martin Beal [cre] (<https://orcid.org/0000-0003-1654-1410>),
Ben Lascelles [ctb]
Maintainer: Martin Beal <martinbeal88@gmail.com>
Repository: CRAN
Date/Publication: 2021-08-07 23:10:01 UTC
Date/Publication: 2022-04-26 16:00:02 UTC
39 changes: 20 additions & 19 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
858b9e434a7acfb65d8ba87cb3000833 *DESCRIPTION
e17809e2754787d9009a2b5b3372ffbb *NAMESPACE
5e0cab40fbb59a2cb6706e035694695c *NEWS.md
18e4bbaf9b46e65fecc7473861e4f7bb *DESCRIPTION
93e3b9916b77a848ae93ebc3c11542bd *NAMESPACE
83e568f7597ce837e83b2d83dc87eb4e *NEWS.md
5afb06434961b0be419fbe9735f7b859 *R/data.R
ab012c486074aba8d04797c85309d4c8 *R/estSpaceUse.r
e29ac7667e9c1c76479e4dea81ba8892 *R/findScale.R
6103697a1209ac99d60ebf5e8443cfb0 *R/estSpaceUse.r
ec39b7061af0d398a8c72e55933e8a43 *R/findScale.R
9b572462a47ddcf629dcefc35a23f337 *R/findSite.R
634f7dfde76b4a888af6058b5787ea46 *R/formatFields.R
e8f2b82858933e8f67a71c0c3abf271e *R/indEffectTest.R
23ba043ce4205dc3887cfa2825065d1d *R/mapKDE.R
ac3297c0ddfe8866153d16ebe13bad4a *R/mapSite.R
f02218e46dce91e91031424a90ba5730 *R/indEffectTest.R
ab8463d85fd6da48fe7dcf472b9c3936 *R/mapKDE.R
4c5697fee9ec3f9fe8ef63b982d6ef7e *R/mapSite.R
df17739628efa1556aeb7870d9f3b08d *R/mapTrips.R
2d3d8cb67283eafc41ac9bec26500bd4 *R/move2KBA.r
7fea76ab1d809a59775d86ef93da0fc5 *R/move2KBA.r
c7bfad1743d262db2f2754ae3e6468a5 *R/projectTracks.R
1ce1db6e154414a1511540d5855c4eb8 *R/repAssess.r
02cd2377fe5221bfc8978e1d12273f27 *R/repAssess.r
05e2ee19cab1a56b2c136d5376a3bee5 *R/tripSplit.r
27498d41c37adff06f4c6a15f25c9fbd *R/tripSummary.r
976c4ab79dc5cabf9046e920a2c7e152 *README.md
4602b9b161e6b7fc2f788a283f713486 *build/vignette.rds
39c6d854a52914f0d575f9bdff5b3074 *R/tripSummary.r
c0c01deda993b653a950260bfc824ec9 *README.md
b5ce74432b1e2cfb81bd9e24075ebcb4 *build/vignette.rds
0ec0d3e2720c25cf1f2928f2c4771bbc *data/KDE_example.rda
6aa6e7e87ffbef6b951ff18d494cd295 *data/boobies.rda
621677aa1dd7f1e23280e18e9dc99611 *inst/doc/track2kba_workflow.R
2c607f035bcd97147ae4a55df5c78ed4 *inst/doc/track2kba_workflow.Rmd
42c4efa857473900a370cce8ef2a42fa *inst/doc/track2kba_workflow.html
31384b8205170d4954fb5c09392d600f *inst/CITATION
89ee74ee7a77e77fa2245026eb15b91c *inst/doc/track2kba_workflow.R
aa690e44704a2fb3c36a3dce4d88730b *inst/doc/track2kba_workflow.Rmd
92ba28cf12e7e1d69307391b7a8871ce *inst/doc/track2kba_workflow.html
6456da43b40fbc0072f215c4c59dd47f *inst/tinytest/boobies_testdata.csv
3a641a98f789ced53371662e8fb83095 *inst/tinytest/movebank_testdata.csv
b372cfe93ecfed0c206c9b2c97bd88b1 *inst/tinytest/test_estSpaceUse.R
Expand All @@ -43,14 +44,14 @@ c0e9741aa986d789d90538626267ae51 *man/estSpaceUse.Rd
c2d3fd4403b3fd2888df52181ff194db *man/figures/KBA_sp_plot.png
ec999a2da8b41eb76aedaafba10fee5c *man/figures/estSpaceUse-1.png
c44395cf03534ac7a36d15954ca1f96b *man/figures/findScale-1.png
a0089c638427bf6e500fbf540dd9c7a3 *man/figures/logo.png
52df063d44f5bca0f54ff3211953ce11 *man/figures/logo.png
5eaaa0d51bca3db52c7a69117bd21f55 *man/figures/plot_KBA_sf.png
bf7a5d90d020baf91712aba59960d8f8 *man/figures/repAssess-1.png
96c8090440db043fc6ec40e557b19e69 *man/figures/tripSplit-chunk-3-1.png
b454598cf37e2eada7bd9d3da1920220 *man/findScale.Rd
c51a0dee672082acef6d752f3797b77d *man/findSite.Rd
bd34091a71c6da3da369a49d264535c2 *man/formatFields.Rd
8ef1cfbd51cd57f94fa47443b536aa19 *man/indEffectTest.Rd
c144bb694e1693f4641dd5355cd1e593 *man/indEffectTest.Rd
b7347953469348e572ec48fdca79d171 *man/mapKDE.Rd
7821abc97cc970fd04b5964408574dc5 *man/mapSite.Rd
dcc9da9d8d4d9f974a9d623a6229c3d2 *man/mapTrips.Rd
Expand All @@ -65,5 +66,5 @@ ec999a2da8b41eb76aedaafba10fee5c *vignettes/estSpaceUse-1.png
c44395cf03534ac7a36d15954ca1f96b *vignettes/findScale-1.png
5eaaa0d51bca3db52c7a69117bd21f55 *vignettes/plot_KBA_sf.png
bf7a5d90d020baf91712aba59960d8f8 *vignettes/repAssess-1.png
2c607f035bcd97147ae4a55df5c78ed4 *vignettes/track2kba_workflow.Rmd
aa690e44704a2fb3c36a3dce4d88730b *vignettes/track2kba_workflow.Rmd
96c8090440db043fc6ec40e557b19e69 *vignettes/tripSplit-chunk-3-1.png
10 changes: 9 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ export(projectTracks)
export(repAssess)
export(tripSplit)
export(tripSummary)
import(dplyr)
import(rgdal)
import(rgeos)
import(sp)
importFrom(Matching,ks.boot)
importFrom(adehabitatHR,estUDm2spixdf)
importFrom(adehabitatHR,getverticeshr)
importFrom(adehabitatHR,kernelUD)
Expand All @@ -24,6 +26,7 @@ importFrom(dplyr,filter)
importFrom(dplyr,first)
importFrom(dplyr,group_by)
importFrom(dplyr,if_else)
importFrom(dplyr,lag)
importFrom(dplyr,last)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
Expand Down Expand Up @@ -63,8 +66,13 @@ importFrom(graphics,points)
importFrom(graphics,polygon)
importFrom(graphics,text)
importFrom(magrittr,"%>%")
importFrom(maps,map)
importFrom(maptools,spRbind)
importFrom(methods,as)
importFrom(move,getMovebank)
importFrom(move,getMovebankData)
importFrom(move,getMovebankID)
importFrom(move,movebankLogin)
importFrom(rlang,.data)
importFrom(sf,st_as_sf)
importFrom(sf,st_bbox)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Version 1.0.1.9000

# Version 1.0.1

Fixing CRAN checks.
Expand Down
1 change: 1 addition & 0 deletions R/estSpaceUse.r
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#'KDE <- estSpaceUse(tracks, scale=10, levelUD = 50)
#'
#' @export
#' @import rgdal
#' @importFrom stats na.omit quantile sd var
#' @importFrom methods as
#' @importFrom adehabitatHR getverticeshr kernelUD
Expand Down
2 changes: 1 addition & 1 deletion R/findScale.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
#' h_vals <- findScale(tracks_prj, sumTrips = sumTrips, scaleARS = FALSE)
#'
#' @export
#' @import dplyr
#' @importFrom dplyr lag
#' @import sp
#' @importFrom stats setNames

Expand Down
6 changes: 1 addition & 5 deletions R/indEffectTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,17 @@
#'
#' @export
#' @importFrom ggplot2 aes geom_boxplot
#' @importFrom Matching ks.boot
#' @import sp

indEffectTest <- function(
tracks, tripID, groupVar, plot=TRUE,
method = c("HR", "PHR", "VI", "BA", "UDOI", "HD"),
conditional = TRUE, levelUD=50, scale, grid = 500, iterations = 1000) {

if (!requireNamespace("Matching", quietly = TRUE)) {
stop("Package \"Matching\" needed for function to work. Please install.",
call. = FALSE) }

if (!(tripID) %in% names(tracks)) stop("Within-group field does not exist")
if (!groupVar %in% names(tracks)) stop("Group field does not exist")


tracks@data <- tracks@data %>%
dplyr::select({{groupVar}}, {{tripID}}, .data$Latitude, .data$Longitude)

Expand Down
9 changes: 4 additions & 5 deletions R/mapKDE.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@
#'mapKDE(KDE)
#'
#' @export
#' @importFrom maps map
#' @importFrom sf st_bbox
#' @importFrom ggplot2 geom_sf coord_sf borders ggplot theme element_rect
#' @importFrom ggplot2 theme element_rect ylab xlab
#' @importFrom graphics image

mapKDE <- function(KDE, colony=NULL, show=TRUE) {
### Polygon data ###
if (class(KDE)[1] == "sf") {
if (!requireNamespace("maps", quietly = TRUE)) { stop(
"Packages \"maps\"is needed. Please install it.", call. = FALSE)
}
if (inherits(KDE, "sf")) {

coordsets <- sf::st_bbox(KDE)
UDPLOT <- ggplot(KDE) + geom_sf(data = KDE, aes(col = id), fill = NA) +
UDPLOT <- ggplot(KDE) + geom_sf(data = KDE, aes(col = .data$id), fill = NA) +
coord_sf(
xlim = c(coordsets$xmin, coordsets$xmax),
ylim = c(coordsets$ymin, coordsets$ymax), expand = TRUE) +
Expand Down
9 changes: 4 additions & 5 deletions R/mapSite.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@
#' mapSite(pot_site)
#'
#' @export
#' @import rgeos
#' @importFrom sf st_bbox
#' @importFrom ggplot2 geom_sf coord_sf borders ggplot theme element_rect
#' @importFrom ggplot2 ylab xlab scale_fill_continuous scale_colour_continuous
#' @importFrom ggplot2 geom_point guides aes element_line

mapSite <- function(Site, colony=NULL, show=TRUE) {
if (class(Site)[1] == "sf") {
if (!requireNamespace("maps", quietly = TRUE)) { stop(
"Packages \"maps\"is needed. Please install it.", call. = FALSE)
}
if (inherits(Site, "sf")) {

coordsets <- sf::st_bbox(Site)

csf <- ggplot2::coord_sf(
Expand Down Expand Up @@ -102,7 +101,7 @@ mapSite <- function(Site, colony=NULL, show=TRUE) {
print(denseplot)
} else { return(denseplot) }

} else if (class(Site) == "SpatialPixelsDataFrame") {
} else if (inherits(Site,"SpatialPixelsDataFrame")) {
plot(Site[Site$N_IND > 0, ])
} else { stop("'Site' is not an sf nor SpatialPixelsDataFrame object") }

Expand Down
4 changes: 1 addition & 3 deletions R/move2KBA.r
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@
#'}
#'
#' @export
#' @importFrom move movebankLogin getMovebankID getMovebankData getMovebank
#' @importFrom magrittr %>%
#' @importFrom dplyr select rename arrange

move2KBA <- function(movebankID=NULL, user=NULL, password=NULL, filename=NULL) {
if (!requireNamespace("move", quietly = TRUE)) {
stop("Package \"move\" needed. Please install.", call. = FALSE)
}

### IMPORT FROM MOVEBANK IF CREDENTIALS SUPPLIED ----------------------------
if (any(!is.null(movebankID), !is.null(user), !is.null(password))) {
Expand Down
6 changes: 3 additions & 3 deletions R/repAssess.r
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ repAssess <- function(
if (is.null(KDE)) {
stop("No Utilization Distributions supplied to KDE argument.
See track2KBA::estSpaceUse()")
} else if (class(KDE) == "estUDm") {
} else if (inherits(KDE, "estUDm")) {
KDEraster <- raster::stack(lapply(KDE, function(x) {
raster::raster(as(x, "SpatialPixelsDataFrame"), values = TRUE)
}))
} else if (class(KDE) == "SpatialPixelsDataFrame") {
} else if (inherits(KDE, "SpatialPixelsDataFrame")) {
KDEraster <- raster::stack(KDE)
} else if (class(KDE) == "RasterStack") {
} else if (inherits(KDE, "RasterStack")) {
KDEraster <- KDE
}

Expand Down
2 changes: 1 addition & 1 deletion R/tripSummary.r
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ tripSummary <- function(trips, colony=NULL, nests=FALSE, extraDist=FALSE)
### helper function to calculate distance unless no previous location -------
poss_dist <- purrr::possibly(geosphere::distm, otherwise = NA)

if(class(trips) == "SpatialPointsDataFrame") {
if(inherits(trips, "SpatialPointsDataFrame")) {
trips <- as.data.frame(trips@data)
} else { trips <- trips }

Expand Down
48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<!-- badges: start -->
[![R-CMD-check](https://github.com/BirdLifeInternational/track2kba/workflows/R-CMD-check/badge.svg)](https://github.com/BirdLifeInternational/track2kba/actions)
[![Coverage
Status](https://codecov.io/gh/BirdLifeInternational/track2kba/branch/master/graph/badge.svg)](https://codecov.io/gh/BirdLifeInternational/track2kba/)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/track2KBA)](https://cran.r-project.org/package=track2KBA)
Status](https://codecov.io/gh/BirdLifeInternational/track2kba/branch/master/graph/badge.svg)](https://app.codecov.io/gh/BirdLifeInternational/track2kba)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/track2KBA)](https://cran.r-project.org/package=track2KBA)
[![CRAN_Status_Badge](https://cranlogs.r-pkg.org/badges/track2KBA)](https://cran.r-project.org/package=track2KBA)
<!-- badges: end -->

This package is comprised of functions that facilitate the
identification of areas of importance for biodiversity, such as Key
Biodiversity Areas (KBAs), based on individual tracking data. For
further detail concerning the method itself, please refer to this
[paper](https://onlinelibrary.wiley.com/doi/full/10.1111/ddi.12411) by
Lacelles et al. (2016).
[paper](https://doi.org/10.1111/2041-210X.13713) by Beal et al. (2021).

Key functions include utilities to estimate individual core use areas,
the level of representativeness of the tracked sample, and overlay
Expand All @@ -28,7 +28,13 @@ data set, and splitting and summarizing individual foraging trips.

------------------------------------------------------------------------

You can download the development version from
You can download the stable version from CRAN with:

``` r
install.packages("track2KBA")
```

Or you can download the development version from
[GitHub](https://github.com/) with:

``` r
Expand All @@ -55,7 +61,7 @@ fields, and an ID field (i.e. individual animal, track, or trip).
library(track2KBA) # load package

data(boobies)
# ?boobies # for some background on the available data set
# ?boobies # for some background info on the example data set

dataGroup <- formatFields(
dataGroup = boobies,
Expand Down Expand Up @@ -308,7 +314,7 @@ This map shows the number or proportion of individual animals in the
population overlapping in space. The red lines indicate the ‘potential
site’; that is, the areas used by a significant proportion of the local
population, given the representativeness of the sample of tracked
individuals. In this case, since representativeness is &gt;90%, any area
individuals. In this case, since representativeness is \>90%, any area
used by 10% or more of the population is considered important (see
Lascelles et al. 2016 for details). The orange dot is the colony
location and the black line is the coastline.
Expand Down Expand Up @@ -349,29 +355,41 @@ around the breeding island.

------------------------------------------------------------------------

### Reference
### Package reference

If you use any functions in this package for your work, please use the
following citation:

Martin Beal, Steffen Oppel, Jonathan Handley, Lizzie Pearmain, Virginia
Morera-Pujol, Mark Miller, Phil Taylor, Ben Lascelles, & Maria Dias.
(2020, May 13). *BirdLifeInternational/track2kba: First Release (Version
0.5.0). Zenodo. <https://doi.org/10.5281/zenodo.3823902>*
Beal, M., Oppel, S., Handley, J., Pearmain, E. J., Morera-Pujol, V.,
Carneiro, A. P. B., Davies, T. E., Phillips, R. A., Taylor, P. R.,
Miller, M. G. R., Franco, A. M. A., Catry, I., Patrício, A. R., Regalla,
A., Staniland, I., Boyd, C., Catry, P., & Dias, M. P. (2021). track2KBA:
An R package for identifying important sites for biodiversity from
tracking data. Methods in Ecology and Evolution, n/a(n/a).
<https://doi.org/10.1111/2041-210X.13713>

### Example data
### Example data reference

Oppel, S., Beard, A., Fox, D., Mackley, E., Leat, E., Henry, L.,
Clingham, E., Fowler, N., Sim, J., Sommerfeld, J., Weber, N., Weber, S.,
Bolton, M., 2015. *Foraging distribution of a tropical seabird supports
Ashmole’s hypothesis of population regulation. Behav Ecol Sociobiol 69,
915–926. <https://doi.org/10.1007/s00265-015-1903-3>*

Thanks to Annalea Beard for kindly sharing these example data for use in
the package.
### Other references

Lascelles, B. G., Taylor, P. R., Miller, M. G. R., Dias, M. P., Oppel,
S., Torres, L., Hedd, A., Corre, M. L., Phillips, R. A., Shaffer, S. A.,
Weimerskirch, H., & Small, C. (2016). Applying global criteria to
tracking data to define important areas for marine conservation.
Diversity and Distributions, 22(4), 422–431.
<https://doi.org/10.1111/ddi.12411>

### Acknowledgements

Thanks to Annalea Beard for kindly sharing these example data for use in
the package.

This project has received funding from the European Union’s Horizon 2020
research and innovation programme under the Marie Skłodowska-Curie grant
agreement No 766417.
Binary file modified build/vignette.rds
Binary file not shown.

0 comments on commit ba4dc02

Please sign in to comment.