diff --git a/pkg/R/context.R b/pkg/R/context.R index 9ad21cac2bd54..c3db1e14399e3 100644 --- a/pkg/R/context.R +++ b/pkg/R/context.R @@ -128,7 +128,7 @@ parallelize <- function(sc, coll, numSlices = 1) { #' #' sc <- sparkR.init() #' # Include the matrix library we will be using -#' includePackage(Matrix) +#' includePackage(sc, Matrix) #' #' generateSparse <- function(x) { #' sparseMatrix(i=c(1, 2, 3), j=c(1, 2, 3), x=c(1, 2, 3)) diff --git a/pkg/man/includePackage.Rd b/pkg/man/includePackage.Rd index 005ebcf636b2a..0bbf938763356 100644 --- a/pkg/man/includePackage.Rd +++ b/pkg/man/includePackage.Rd @@ -1,3 +1,4 @@ +% Generated by roxygen2 (4.0.2): do not edit by hand \name{includePackage} \alias{includePackage} \title{Include this specified package on all workers} @@ -5,17 +6,16 @@ includePackage(sc, pkg) } \arguments{ - \item{sc}{SparkContext to use} +\item{sc}{SparkContext to use} - \item{pkg}{Package name} +\item{pkg}{Package name} } \description{ -This function can be used to include a package on all -workers before the user's code is executed. This is useful -in scenarios where other R package functions are used in a -function passed to functions like \code{lapply}. NOTE: The -package is assumed to be installed on every node in the -Spark cluster. +This function can be used to include a package on all workers before the +user's code is executed. This is useful in scenarios where other R package +functions are used in a function passed to functions like \code{lapply}. +NOTE: The package is assumed to be installed on every node in the Spark +cluster. } \examples{ \dontrun{ @@ -23,7 +23,7 @@ Spark cluster. sc <- sparkR.init() # Include the matrix library we will be using - includePackage(Matrix) + includePackage(sc, Matrix) generateSparse <- function(x) { sparseMatrix(i=c(1, 2, 3), j=c(1, 2, 3), x=c(1, 2, 3))