Passer au contenu

Creates a summary for each tag of it's first and last detection time, first and last detection site, length of time between first and last detection, straight line distance between first and last detection site, rate of movement, and bearing

Utilisation

tagSum(data)

Arguments

data

a selected table from .motus data, eg. "alltagsGPS", or a data.frame of detection data including at a minimum variables for motusTagID, fullID, recvDeployLat, recvDeployLon, recvDeployName, ts, gpsLat, gpsLon

Valeur de retour

a data.frame with these columns:

  • fullID: fullID of Motus registered tag

  • first_ts: time of first detection of tag

  • last_ts: time of last detection of tag

  • first_site: first detection site of tag

  • last_site: last detection site of tag

  • lat.x: latitude of first deteciton site of tag

  • lon.x: longitude of first deteciton site of tag

  • lat.y: latitude of last deteciton site of tag

  • lon.y: longitude of last deteciton site of tag

  • tot_ts: length of time between first and last detection of tag (in seconds)

  • dist: total straight line distance between first and last detection site (in metres), see latLonDist function in sensorgnome package for details

  • rate: overall rate of movement (tot_ts/dist), in metres/second

  • bearing: bearing between first and last detection sites, see bearing function in geosphere package for more details

Exemples

# You can use either a selected tbl from .motus eg. "alltagsGPS", or a
# data.frame, instructions to convert a .motus file to all formats are below.

# download and access data from project 176 in sql format
# usename and password are both "motus.sample"
if (FALSE) sql.motus <- tagme(176, new = TRUE, update = TRUE)

# use example sql file included in `motus`
sql.motus <- tagme(176, update = FALSE, 
                   dir = system.file("extdata", package = "motus"))

# convert sql file "sql.motus" to a tbl called "tbl.alltags"
library(dplyr)
tbl.alltags <- tbl(sql.motus, "alltagsGPS") 

# convert the tbl "tbl.alltags" to a data.frame called "df.alltags"
df.alltags <- tbl.alltags %>% 
  collect() %>% 
  as.data.frame()

# Create tag summary for all tags within detection data using tbl file
# tbl.alltags
tag_summary <- tagSum(tbl.alltags)

# Create site summaries for only select tags using tbl file tbl.alltags
tag_summary <- tagSum(filter(tbl.alltags, 
                             motusTagID %in% c(16047, 16037, 16039)))

# Create site summaries for only a select species using data.frame df.alltags
tag_summary <- tagSum(filter(df.alltags, speciesEN == "Red Knot"))