dpdetect_e: Detect measurement ending point automatically using...

View source: R/detect.R

dpdetect_eR Documentation

Detect measurement ending point automatically using changepoint segmentation

Description

The opposite of the dpdetect_s, it will check the mean values of the last four segments and compare them to the cutoff limit. Will give a warning if end not detected, which is expected on measurements where the needle did not exit the tree on the opposite side of the tree. See return.plot = TRUE to display the actual process. The function is called on a dp object and returns either a row number of the measurement ending or a plot displaying the segmentation and detection. The sensitivity can be adjusted using the cutoff.sd parameter, which is an indicator on how many standard deviations the segment mean value can be before cutting it off.

Usage

dpdetect_e(
  dp,
  cutoff.sd = 1,
  return.plot = FALSE,
  minseglen = 250,
  span = 0.1,
  nroll = 100
)

Arguments

dp

A dp object, see dpload.

cutoff.sd

How many standard deviations for the cutoff limit?

return.plot

If true, will return a plot displaying segment detection for the current dp file.

minseglen

Minimum segment length for segment detection, default setting of 250 points is for data resolution of 1/100 mm, test a few options with return.plot = TRUE to find the right value

span

Span for loess regression, use to adjust sensitivity of detection detection for the current dp file.

nroll

Number of points for rolling mean, use to adjust sensitivity of detection for the current dp file.

Value

Either a row number where the actual measurement ends or a plot, displaying changepoint segmentation and set limits.

See Also

dpdetect_s, dptrim, dptriml, dptrim_s, dptriml_s

Examples

## load a single file
dp <- dpload(system.file("extdata", "00010001.dpa", package = "densitr"))
## get ending point
start <- dpdetect_e(dp)
## plot the end detection

dpdetect_e(dp, return.plot = TRUE)


krajnc/densitr documentation built on April 5, 2022, 7:49 p.m.