Rdistance v4.0.3 on CRAN now

Major overhaul of distance analysis package Rdistance is on CRAN

R
Distance Analysis
Author

Trent McDonald

Published

March 29, 2025

The latest Rdistance, version 4.0.3, is on CRAN now. This version of Rdistance is a major overhaul and improvement in the workflow in R. Among other things, the changes in v4.0.3 make distance sampling estimation compatible with other tidyverse methods.


A Major Update

Biggest Change

Rdistance versions > 4.0.0 require a single nested data frame rather than two. In previous versions, distance-sampling data was split between a ‘site’ data frame and a ‘detection’ data frame. Now, both ‘site’ and ‘detection’ information are stored in a single nested data frame. The new format is nested because detection data frames are ‘nested’ within list cells of the site data frame. Technically, the new data frame format is a grouped tibble with one row per group, and each group is a transect. Survey type, observer system, and name of the effort column are recorded as attributes in the new data frame.

Functions in v4.0.3 to construct and inspect the new data frame format are:

  • RdistDf constructs the new Rdistance data frames from separate transect and detection data frames. Use this function on old sets of site and detection data frames to construct the new nested data frames. See examples in ?RdistDf.
  • is.RdistDf checks the validity of the new Rdistance data frames.
  • summary prints a summary of number of transects, number of groups seen, number of individuals, etc.
  • unnest un-nests the data frame and produces a data frame with one detection per row. Rdistance’s unnest function is different from tidyr::unnest in that zero transects are included in Rdistance’s veersion.

Temporary Functionality Removal

Versions >4.0.0 are a near complete re-write of versions <3.1.3. The package maintainer felt the re-write was necessary to improve stability of the code and lay the ground work for future functionality improvements. But, to keep from going insane, the maintainer is rolling out new versions that build on one another, with core functions first (in 4.0.* versions). As such, they temporarily removed the following functionality from versions with numbers 4.0.*:

  • Logistic distance function form.
  • Smoothed distance functions.
  • Beta distribution distance functions.
  • Double-observer methods.
  • All vignettes. Instead see the Rdistance Tutorials

Other changes

  • print, summary, and plot methods have been improved.
  • Documentation updated and improved.
  • Rdistance options can now be assessed by the regular options function. All Rdistance options are prefixed with ‘Rdist_’ to distinguish them from other options.
  • New data frame format is pipe-able through the estimation workflow. For example, the basic workflow is df |> dfuncEstim(dist~1) |> abundEstim(), which will estimate a distance function and density in one go.
  • Less then full transect widths and less than full circles can be used by setting the new parameter propUnitSurveyed to the proportion of the standard unit that was surveyed. For example, if only one half of transects were surveyed, set propUnitSurveyed = 1. If only one-quarter of a circle was observed during point surveyes, set propUnitSurveyed = 0.25.