R/predict.kmeans.R

Defines functions predict.kmeans

#' @importFrom stats na.pass
#' @export
#' 
stats::na.pass


#' @importFrom clue cl_predict
#' @export
#' 
predict.kmeans <- 
function(object, 
         newdata, 
         #na.action = na.pass,
         ...) 
{
  if (missing(newdata) || is.null(newdata)) return(object$cluster)
  x <- clue::cl_predict(object, newdata, type = "class_ids")
  as.integer(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.