R/getclusterranges.R

Defines functions getclusterranges

Documented in getclusterranges

# vim: set noexpandtab tabstop=2:
#' Get the Cluster Ranges in a Vector of 1D Coordinates
#'
#' Get the Cluster Ranges in a Vector of 1D Coordinates
#'
#' @param x a numeric vector
#' @param gap the size for the recognation of data free gaps
#' @keywords distribution
#' @export
#' @examples
#' x = c(1:3, 11:13)
#' getclusterranges(x, 3)
getclusterranges=function(x, gap) {
	is_gap = diff(x) > gap
	data.frame(
		left=x[c(T, is_gap)]
		, right=x[c(is_gap, T)]
		)
}

Try the l1kdeconv package in your browser

Any scripts or data that you put into this service are public.

l1kdeconv documentation built on May 2, 2019, 10:16 a.m.