@@ -243,7 +243,6 @@ setCheckpointDir <- function(sc, dirName) {
243243# '
244244# ' - loading external packages: In order to use a package, you need to load it inside the
245245# ' closure. For example, if you rely on the MASS module, here is how you would use it:
246- # '
247246# '\dontrun{
248247# ' train <- function(hyperparam) {
249248# ' library(MASS)
@@ -253,6 +252,7 @@ setCheckpointDir <- function(sc, dirName) {
253252# '}
254253# '
255254# ' @rdname spark.lapply
255+ # ' @param sc Spark Context to use
256256# ' @param list the list of elements
257257# ' @param func a function that takes one argument.
258258# ' @return a list of results (the exact type being determined by the function)
@@ -261,8 +261,7 @@ setCheckpointDir <- function(sc, dirName) {
261261# '\dontrun{
262262# ' doubled <- spark.lapply(1:10, function(x){2 * x})
263263# '}
264- spark.lapply <- function (list , func ) {
265- sc <- get(" .sparkRjsc" , envir = .sparkREnv )
264+ spark.lapply <- function (sc , list , func ) {
266265 rdd <- parallelize(sc , list , length(list ))
267266 results <- map(rdd , func )
268267 local <- collect(results )
0 commit comments