column_ml_functions: ML functions for Column operations

Description Usage Arguments Details Note Examples

Description

ML functions defined for Column.

Usage

1
2
3
4
5
6
7
8
9
array_to_vector(x)

vector_to_array(x, ...)

## S4 method for signature 'Column'
array_to_vector(x)

## S4 method for signature 'Column'
vector_to_array(x, dtype = c("float64", "float32"))

Arguments

x

Column to compute on.

...

additional argument(s).

dtype

The data type of the output array. Valid values: "float64" or "float32".

Details

array_to_vector Converts a column of array of numeric type into a column of dense vectors in MLlib

vector_to_array Converts a column of MLlib sparse/dense vectors into a column of dense arrays.

Note

array_to_vector since 3.1.0

vector_to_array since 3.1.0

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
df <- read.df("data/mllib/sample_libsvm_data.txt", source = "libsvm")
head(
  withColumn(
    withColumn(df, "array", vector_to_array(df$features)),
    "vector",
    array_to_vector(column("array"))
  )
)

## End(Not run)

SparkR documentation built on June 3, 2021, 5:05 p.m.