R/densSample.x.R

Defines functions .densSample.x

.densSample.x <- function(x, ymin, npts)
{
  i <- !duplicated(x)
  
  output <- list()

  output$x <- x[i]
  
  n <- length(output$x)
  
  output$y <- rep(ymin, n)

  if (n > npts) {
    i <- sample.int(n, npts, replace = FALSE, prob = NULL)

    output$x <- output$x[i]
    output$y <- output$y[i]
  }

  rm(list = ls()[!(ls() %in% c("output"))])

  return(output)
} ## .densSample.x

Try the rebmix package in your browser

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

rebmix documentation built on July 26, 2023, 5:32 p.m.