R/prune.R

Defines functions prune

prune <- function(x, min_length = 1L) {
  n <- length(x$knots)
  w <- which(diff(x$knots) >= min_length)
  
  x$knots <- x$knots[c(w, n)]
  x$values <- x$values[unique(c(0L, w, n)) + 1L]
  x
}

Try the statip package in your browser

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

statip documentation built on Nov. 18, 2019, 1:06 a.m.