turning_point {beadplexr}R Documentation

Turning points

Description

Find turning points (minima and maxima) in a vector.

Usage

turning_point(
  .x,
  .which = c("both", "minima", "maxima"),
  .return = c("value", "index"),
  .adjust = 1.5,
  .k = NULL,
  ...
)

Arguments

.x

A numeric vector or a list of numeric vectors. If the list is named, the names become column names in the returned data.frames

.which

A character indicating the values of interest.

.return

A character giving the desired return type.

.adjust

A numeric giving the adjustment to the adjust argument of stats::density().

.k

Numeric giving the number of expected clusters.

...

Arguments passed on to approx_adjust

.lower

The interval for possible value of adjust.

.upper

The interval for possible value of adjust.

.step

A numeric giving the increment to adjust. Sometimes low values are needed to find a proper adjust value.

Value

A list with the two elements maxima and minima. each element consist of a single data.frame.

Examples


set.seed(1234)
.x <- c(rnorm(100, 2, 1), rnorm(100, 9, 1))

turning_point(.x = .x, .adjust = 1)
turning_point(.x = .x, .k = 2)

turning_point(.x = .x, .which = "minima")
turning_point(.x = .x, .which = "maxima")

turning_point(.x = .x, .return = "index")

[Package beadplexr version 0.4.0 Index]