Skip to content

dssd

Distance Sampling Survey Design

v1.0.3 · Apr 22, 2025 · GPL (>= 2)

Description

Creates survey designs for distance sampling surveys. These designs can be assessed for various effort and coverage statistics. Once the user is satisfied with the design characteristics they can generate a set of transects to use in their distance sampling survey. Many of the designs implemented in this R package were first made available in our 'Distance' for Windows software and are detailed in Chapter 7 of Advanced Distance Sampling, Buckland et. al. (2008, ISBN-13: 978-0199225873). Find out more about estimating animal/plant abundance with distance sampling at <https://distancesampling.org/>.

Downloads

822

Last 30 days

4255th

822

Last 90 days

822

Last year

CRAN Check Status

1 ERROR
13 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 ERROR
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (16 non-OK)
OK r-devel-linux-x86_64-debian-clang

*


            
OK r-devel-linux-x86_64-debian-gcc

*


            
OK r-devel-linux-x86_64-fedora-clang

*


            
OK r-devel-linux-x86_64-fedora-gcc

*


            
ERROR r-devel-macos-arm64

examples

Running examples in ‘dssd-Ex.R’ failed
The error most likely occurred in:

> ### Name: generate.transects
> ### Title: S4 generic method to generate an instance of a design
> ### Aliases: generate.transects
> ###   generate.transects,Line.Transect.Design-method
> ###   generate.transects,Point.Transect.Design-method
> 
> ### ** Examples
> 
> #Point transect example
> shapefile.name <- system.file("extdata", "TrackExample.shp", package = "dssd")
> region <- make.region(region.name = "study area",
+                      shape = shapefile.name)
> design <- make.design(region = region,
+                       transect.type = "point",
+                       design = "random",
+                       samplers = 25,
+                       design.angle = 45,
+                       edge.protocol = "minus",
+                       truncation = 3)
> # Generate a single survey instance
> survey <- generate.transects(design)
> plot(region, survey, covered.area = TRUE)
> 
> #Line transect example
> # Define the design
> design <- make.design(region = region,
+                       transect.type = "line",
+                       design = c("systematic"),
+                       line.length = 1000,
+                       design.angle = c(179),
+                       edge.protocol = "minus",
+                       truncation = 1)
> 
> # Create a single set of transects to check
> survey <- generate.transects(design)
> plot(region, survey, covered.area = TRUE)
Error in `geom_sf()`:
! Problem while converting geom to grob.
ℹ Error occurred in the 3rd layer.
Caused by error in `MtrxSetSet()`:
! polygons not (all) closed
Backtrace:
     ▆
  1. ├─base (local) `<fn>`(x)
  2. ├─ggplot2 (local) `print.ggplot2::ggplot`(x)
  3. │ ├─ggplot2::ggplot_gtable(data)
  4. │ └─ggplot2 (local) `ggplot_gtable.ggplot2::ggplot_built`(data)
  5. │   └─ggplot2:::by_layer(...)
  6. │     ├─rlang::try_fetch(...)
  7. │     │ ├─base::tryCatch(...)
  8. │     │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
  9. │     │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 10. │     │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 11. │     │ └─base::withCallingHandlers(...)
 12. │     └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
 13. │       └─l$draw_geom(d, layout)
 14. │         └─ggplot2 (local) draw_geom(..., self = self)
 15. │           └─self$geom$draw_layer(...)
 16. │             └─ggplot2 (local) draw_layer(..., self = self)
 17. │               └─base::lapply(...)
 18. │                 └─ggplot2 (local) FUN(X[[i]], ...)
 19. │                   ├─rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
 20. │                   └─self$draw_panel(data, panel_params, coord, na.rm = FALSE, legend = "other")
 21. │                     └─ggplot2 (local) draw_panel(..., self = self)
 22. │                       ├─sf::st_as_grob(data$geometry, pch = data$shape, gp = gp, arrow = arrow)
 23. │                       └─sf:::st_as_grob.sfc(...)
 24. │                         └─sf:::st_cast_sfc_default(x)
 25. │                           └─base::lapply(x, function(x) if (inherits(x, "POLYGON")) POLYGON2MULTIPOLYGON(x) else x)
 26. │                             └─sf (local) FUN(X[[i]], ...)
 27. │                               └─sf:::POLYGON2MULTIPOLYGON(x)
 28. │                                 └─sf::st_multipolygon(list(unclass(x)), dim = dim)
 29. │                                   └─sf:::MtrxSetSet(x, dim, type = "MULTIPOLYGON", needClosed = TRUE)
 30. │                                     └─base::stop("polygons not (all) closed")
 31. └─base::.handleSimpleError(...)
 32.   └─rlang (local) h(simpleError(msg, call))
 33.     └─handlers[[1L]](cnd)
 34.       └─cli::cli_abort(...)
 35.         └─rlang::abort(...)
Execution halted
ERROR r-devel-macos-arm64

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘GettingStarted.Rmd’ using rmarkdown
--- finished re-building ‘GettingStarted.Rmd’

--- re-building ‘MultiStrataVignette.Rmd’ using rmarkdown

Quitting from MultiStrataVignette.Rmd:159-172 [seg_design]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error:
! IllegalArgumentException: Points of LinearRing do not form a closed linestring
---
Backtrace:
     ▆
  1. ├─dssd::generate.transects(design)
  2. ├─dssd::generate.transects(design)
  3. │ └─dssd:::gt.LT.fun.body(object, quiet = quiet, ...)
  4. │   └─dssd:::generate.segmented.grid(...)
  5. │     └─base::lapply(lines, sf::st_intersection, y = rot.strata)
  6. │       ├─sf (local) FUN(X[[i]], ...)
  7. │       └─sf:::st_intersection.sfg(X[[i]], ...)
  8. │         ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
  9. │         └─sf:::geos_op2_geom("intersection", x, y, ...)
 10. │           ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
 11. │           └─sf:::CPL_geos_op2(op, x, y)
 12. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'MultiStrataVignette.Rmd' failed with diagnostics:
IllegalArgumentException: Points of LinearRing do not form a closed linestring
--- failed re-building ‘MultiStrataVignette.Rmd’

SUMMARY: processing the following file failed:
  ‘MultiStrataVignette.Rmd’

Error: Vignette re-building failed.
Execution halted
ERROR r-devel-macos-arm64

tests

  Running ‘test-that.R’ [2s/2s]
Running the tests in ‘tests/test-that.R’ failed.
Complete output:
  > library(testthat)
  > library(dssd)
  > 
  > test_check("dssd", filter = "check_.*")
  Saving _problems/test-check_DesignParams-322.R
  Saving _problems/test-check_DesignParams-322.R
  Saving _problems/test-check_Designs-54.R
  Saving _problems/test-check_Designs-54.R
  Saving _problems/test-check_SegDesign-30.R
  Saving _problems/test-check_SegDesign-30.R
  Saving _problems/test-check_UserInput-149.R
  Saving _problems/test-check_UserInput-149.R
  [ FAIL 8 | WARN 0 | SKIP 0 | PASS 83 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-check_DesignParams.R:322:3'): Only the implemented design parameters are stored ──
  Error in `scan(text = lst[[length(lst)]], quiet = TRUE)`: scan() expected 'a real', got 'IllegalArgumentException:'
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design, region) at test-check_DesignParams.R:322:3
    2. ├─dssd::generate.transects(design, region)
    3. │ └─dssd:::gt.LT.fun.body(object, quiet = quiet, ...)
    4. │   └─dssd:::generate.eqspace.zigzags(...)
    5. │     └─base::lapply(lines, sf::st_intersection, y = rot.strata)
    6. │       ├─sf (local) FUN(X[[i]], ...)
    7. │       └─sf:::st_intersection.sfg(X[[i]], ...)
    8. │         ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    9. │         └─sf:::geos_op2_geom("intersection", x, y, ...)
   10. │           ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   11. │           └─sf:::CPL_geos_op2(op, x, y)
   12. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
   13.   └─base::scan(text = lst[[length(lst)]], quiet = TRUE)
  ── Error ('test-check_DesignParams.R:322:3'): Only the implemented design parameters are stored ──
  Error in `(function (msg)  {     on.exit(stop(msg))     lst = strsplit(msg, " at ")[[1]]     pts = scan(text = lst[[length(lst)]], quiet = TRUE)     if (length(pts) == 2 && is.numeric(pts))          assign(".geos_error", st_point(pts), envir = .sf_cache) })("IllegalArgumentException: Points of LinearRing do not form a closed linestring")`: IllegalArgumentException: Points of LinearRing do not form a closed linestring
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design, region) at test-check_DesignParams.R:322:3
    2. ├─dssd::generate.transects(design, region)
    3. │ └─dssd:::gt.LT.fun.body(object, quiet = quiet, ...)
    4. │   └─dssd:::generate.eqspace.zigzags(...)
    5. │     └─base::lapply(lines, sf::st_intersection, y = rot.strata)
    6. │       ├─sf (local) FUN(X[[i]], ...)
    7. │       └─sf:::st_intersection.sfg(X[[i]], ...)
    8. │         ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    9. │         └─sf:::geos_op2_geom("intersection", x, y, ...)
   10. │           ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   11. │           └─sf:::CPL_geos_op2(op, x, y)
   12. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
  ── Error ('test-check_Designs.R:54:3'): Check designs can generate survey transects ──
  Error in `scan(text = lst[[length(lst)]], quiet = TRUE)`: scan() expected 'a real', got 'IllegalArgumentException:'
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design) at test-check_Designs.R:54:3
    2. ├─dssd::generate.transects(design)
    3. │ └─dssd:::generate.systematic.points(...)
    4. │   └─base::lapply(points, FUN = sf::st_intersection, y = rot.strata)
    5. │     ├─sf (local) FUN(X[[i]], ...)
    6. │     └─sf:::st_intersection.sfg(X[[i]], ...)
    7. │       ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    8. │       └─sf:::geos_op2_geom("intersection", x, y, ...)
    9. │         ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   10. │         └─sf:::CPL_geos_op2(op, x, y)
   11. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
   12.   └─base::scan(text = lst[[length(lst)]], quiet = TRUE)
  ── Error ('test-check_Designs.R:54:3'): Check designs can generate survey transects ──
  Error in `(function (msg)  {     on.exit(stop(msg))     lst = strsplit(msg, " at ")[[1]]     pts = scan(text = lst[[length(lst)]], quiet = TRUE)     if (length(pts) == 2 && is.numeric(pts))          assign(".geos_error", st_point(pts), envir = .sf_cache) })("IllegalArgumentException: Points of LinearRing do not form a closed linestring")`: IllegalArgumentException: Points of LinearRing do not form a closed linestring
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design) at test-check_Designs.R:54:3
    2. ├─dssd::generate.transects(design)
    3. │ └─dssd:::generate.systematic.points(...)
    4. │   └─base::lapply(points, FUN = sf::st_intersection, y = rot.strata)
    5. │     ├─sf (local) FUN(X[[i]], ...)
    6. │     └─sf:::st_intersection.sfg(X[[i]], ...)
    7. │       ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    8. │       └─sf:::geos_op2_geom("intersection", x, y, ...)
    9. │         ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   10. │         └─sf:::CPL_geos_op2(op, x, y)
   11. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
  ── Error ('test-check_SegDesign.R:30:3'): Can deal with various forms of user input ──
  Error in `scan(text = lst[[length(lst)]], quiet = TRUE)`: scan() expected 'a real', got 'IllegalArgumentException:'
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design.tm) at test-check_SegDesign.R:30:3
    2. ├─dssd::generate.transects(design.tm)
    3. │ └─dssd:::gt.LT.fun.body(object, quiet = quiet, ...)
    4. │   └─dssd:::generate.segmented.grid(...)
    5. │     └─base::lapply(lines, sf::st_intersection, y = rot.strata)
    6. │       ├─sf (local) FUN(X[[i]], ...)
    7. │       └─sf:::st_intersection.sfg(X[[i]], ...)
    8. │         ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    9. │         └─sf:::geos_op2_geom("intersection", x, y, ...)
   10. │           ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   11. │           └─sf:::CPL_geos_op2(op, x, y)
   12. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
   13.   └─base::scan(text = lst[[length(lst)]], quiet = TRUE)
  ── Error ('test-check_SegDesign.R:30:3'): Can deal with various forms of user input ──
  Error in `(function (msg)  {     on.exit(stop(msg))     lst = strsplit(msg, " at ")[[1]]     pts = scan(text = lst[[length(lst)]], quiet = TRUE)     if (length(pts) == 2 && is.numeric(pts))          assign(".geos_error", st_point(pts), envir = .sf_cache) })("IllegalArgumentException: Points of LinearRing do not form a closed linestring")`: IllegalArgumentException: Points of LinearRing do not form a closed linestring
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design.tm) at test-check_SegDesign.R:30:3
    2. ├─dssd::generate.transects(design.tm)
    3. │ └─dssd:::gt.LT.fun.body(object, quiet = quiet, ...)
    4. │   └─dssd:::generate.segmented.grid(...)
    5. │     └─base::lapply(lines, sf::st_intersection, y = rot.strata)
    6. │       ├─sf (local) FUN(X[[i]], ...)
    7. │       └─sf:::st_intersection.sfg(X[[i]], ...)
    8. │         ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    9. │         └─sf:::geos_op2_geom("intersection", x, y, ...)
   10. │           ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   11. │           └─sf:::CPL_geos_op2(op, x, y)
   12. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
  ── Error ('test-check_UserInput.R:149:3'): Can deal with various forms of user input ──
  Error in `scan(text = lst[[length(lst)]], quiet = TRUE)`: scan() expected 'a real', got 'IllegalArgumentException:'
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design) at test-check_UserInput.R:149:3
    2. ├─dssd::generate.transects(design)
    3. │ └─dssd:::generate.systematic.points(...)
    4. │   └─base::lapply(points, FUN = sf::st_intersection, y = rot.strata)
    5. │     ├─sf (local) FUN(X[[i]], ...)
    6. │     └─sf:::st_intersection.sfg(X[[i]], ...)
    7. │       ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    8. │       └─sf:::geos_op2_geom("intersection", x, y, ...)
    9. │         ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   10. │         └─sf:::CPL_geos_op2(op, x, y)
   11. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
   12.   └─base::scan(text = lst[[length(lst)]], quiet = TRUE)
  ── Error ('test-check_UserInput.R:149:3'): Can deal with various forms of user input ──
  Error in `(function (msg)  {     on.exit(stop(msg))     lst = strsplit(msg, " at ")[[1]]     pts = scan(text = lst[[length(lst)]], quiet = TRUE)     if (length(pts) == 2 && is.numeric(pts))          assign(".geos_error", st_point(pts), envir = .sf_cache) })("IllegalArgumentException: Points of LinearRing do not form a closed linestring")`: IllegalArgumentException: Points of LinearRing do not form a closed linestring
  Backtrace:
       ▆
    1. ├─dssd::generate.transects(design) at test-check_UserInput.R:149:3
    2. ├─dssd::generate.transects(design)
    3. │ └─dssd:::generate.systematic.points(...)
    4. │   └─base::lapply(points, FUN = sf::st_intersection, y = rot.strata)
    5. │     ├─sf (local) FUN(X[[i]], ...)
    6. │     └─sf:::st_intersection.sfg(X[[i]], ...)
    7. │       ├─sf:::get_first_sfg(geos_op2_geom("intersection", x, y, ...))
    8. │       └─sf:::geos_op2_geom("intersection", x, y, ...)
    9. │         ├─sf::st_sfc(CPL_geos_op2(op, x, y), crs = st_crs(x))
   10. │         └─sf:::CPL_geos_op2(op, x, y)
   11. └─sf (local) `<fn>`("IllegalArgumentException: Points of LinearRing do not form a closed linestring")
  
  [ FAIL 8 | WARN 0 | SKIP 0 | PASS 83 ]
  Error:
  ! Test failures.
  Execution halted
OK r-devel-windows-x86_64

*


            
OK r-oldrel-macos-arm64

*


            
OK r-oldrel-macos-x86_64

*


            
OK r-oldrel-windows-x86_64

*


            
OK r-patched-linux-x86_64

*


            
OK r-release-linux-x86_64

*


            
OK r-release-macos-arm64

*


            
OK r-release-macos-x86_64

*


            
OK r-release-windows-x86_64

*


            

Check History

ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 9, 2026
ERROR r-devel-macos-arm64

examples

Running examples in ‘dssd-Ex.R’ failed
The error most likely occurred in:

> ### Name: generate.transects
> ### Title: S4 generic method to generate an instance of a design
> ### Aliases: generate.transects
> ###   generate.transects,Line.Transect.Design-method
> ###   generate.transects,Point.Transect.Design-method
> 
> ### ** Examples
> 
> #Point transect example
> shapefile.name <- system.file("extdata", "TrackExample.shp", package = "dssd")
> region <- make.region(region.name = "study area",

Reverse Dependencies (1)

depends

Dependency Network

Dependencies Reverse dependencies sf ggplot2 dsims dssd

Version History

new 1.0.3 Mar 10, 2026