R/ft_vector_slicer.R

Defines functions ft_vector_slicer

ft_vector_slicer <- function (x, input.col = NULL, output.col = NULL, indices = c(1), ...) {
  ml_backwards_compatibility_api()
  class <- "org.apache.spark.ml.feature.VectorSlicer"
  # indices need to be array !!!!!
  if(is.vector(indices)){
    indices <- as.array(unique(as.integer(indices - 1))) # sacla array start from 0 !!
  }else{
    message(paste("indices need to be a vector, but a", class(indices)))
    indices <- array()
  }
  
  invoke_simple_transformer(x, class, list(setInputCol = ensure_scalar_character(input.col),
                                           setOutputCol = ensure_scalar_character(output.col),
                                           setIndices = indices))
}
environment(ft_vector_slicer) <- asNamespace('sparklyr')
catlain/sparklyrfun documentation built on Jan. 21, 2018, 4:11 a.m.