Segments NARWC line-transect survey data for distance sampling and density
surface models (Distance, dsm).
Input format: Kenney, R.D. (2023) The North Atlantic Right Whale Consortium Database: A Guide for Users and Contributors, Version 8. Handbook (PDF).
remotes::install_github("chross22/distsamp")Depends on narwcr, installed automatically.
path <- system.file("extdata", "narwc-example.csv", package = "distsamp")Synthetic. No real NARWC records are included.
library(distsamp)
dat <- read_narwc(path)dat <- prepare_survey(dat, platform = "aerial")Builds line occupations, fills LEGSTAGE, filters by platform, flags effort.
validate_narwc(dat)
diagnose_pipeline(dat, seg_length = 5)
plot_survey(dat, "occupations")segs <- segment_survey(dat, seg_length = 5, seed = 1)
segs$segments # one row per segment
segs$detections # one row per sighting, with distance
segments_wide(segs)
plot(segs, what = "segments")seed makes the segmentation reproducible.
flat <- detection_data(segs, area = 5811) # area in km^2library(Distance)
fit <- ds(flat, key = "hn", convert_units = 0.001) # m distances, km effortFull steps to an abundance estimate: docs/11-distance-sampling-steps.md.
sea <- prepare_survey(dat, platform = "vessel")
segs <- segment_survey(sea, seg_length = 10, platform = "vessel", seed = 1)
platform_defaults("vessel")| Column | Unit |
|---|---|
seg_eff |
km |
distance |
m (default) or km (distance_units = "km") |
narwc_codes("LEGTYPE") # handbook code books
filter_days(dat, years = 2024) # subset by date
dist_methods() # along-track distance formulasPipeline scripts in R/ are numbered in the order they are used, from
00-reexports.R (reading) to 13-detection-data.R (the Distance table).
12-segment-survey.R runs steps 01 to 11. Unnumbered files are checks,
plotting and helpers. See docs/10-code-guide.md.
| Topic | File |
|---|---|
| Analysis steps | docs/11-distance-sampling-steps.md |
| Code guide | docs/10-code-guide.md |
| New dataset | docs/08-onboarding-a-real-extract.md |
| Shipboard surveys | docs/09-shipboard-surveys.md |
| Defects fixed from original code | docs/03-bug-fixes.md |
| References | docs/06-references.md |
| All documents | docs/README.md |
vignette("segmenting-narwc-data", package = "distsamp")
vignette("from-segments-to-density", package = "distsamp")citation("distsamp")Returns the package, the segmentation method (Becker et al. 2010) and the data
format (Kenney 2023). Report the seed used.
All sources, and what each is relied on for: docs/06-references.md.