lapply,RDD,function-method {SparkR}R Documentation

Apply a function to all elements

Description

This function creates a new RDD by applying the given transformation to all elements of the given RDD

Usage

## S4 method for signature 'RDD,'function''
lapply(X, FUN)

map(X, FUN)

## S4 method for signature 'RDD,'function''
map(X, FUN)

Arguments

X

The RDD to apply the transformation.

FUN

the transformation to apply on each element

Value

a new RDD created by the transformation.

Examples

## Not run: 
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, 1:10)
##D multiplyByTwo <- lapply(rdd, function(x) { x * 2 })
##D collect(multiplyByTwo) # 2,4,6...
## End(Not run)

[Package SparkR version 0.1 Index]