Rdistance v4.0.3 on CRAN now

Major overhaul of distance analysis package Rdistance is on CRAN

Author

Trent McDonald

Published

March 29, 2025

Modified

July 23, 2025

A new version of Rdistance, version 4.0.3, is on CRAN now. This version of Rdistance represents a major overhaul and improvement in workflow. 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 un-nested data frame. 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. In the new format, each row in the data frame represents one ‘site’ and all detection information (e.g., distances, groupsizes, covariates) associated with a single ‘site’ are ‘nested’ within a list cell on that row. Technically, the new data frame format is a grouped tibble with one row per group, and each group is a ‘site’. 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. Call this function with ‘site’ and ‘detection’ data frames used in previous versions 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 sites, 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 sites are included in Rdistance’s version. Zero sites are transects or points on which no detections were made.

Temporary Functionality Removal

Version 4.0.3 is 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.

Other changes

  • All vignettes have been re-branded as ‘Tutorials’ and moved to the Rdistance Tutorials page on this website. Vignettes moved becuase they were getting long, package maintainer has more control over them, and they look better. In addition, moving them reduces Rdistance’s download size.
  • print, summary, and plot methods have been improved.
  • Documentation updated and improved.
  • Rdistance options can now be set and assessed using the 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 all at once.
  • Less then full transect widths and less than full circles can be used by setting a new parameter, propUnitSurveyed, propUnitSurveyed should be set to the proportion of the standard unit that was surveyed. For example, if only one side of all transects were surveyed, set propUnitSurveyed = 0.5. If only one-quarter of a circle was observed during point surveyes, set propUnitSurveyed = 0.25.