From 560ff0e3f448827f0a72f4e65f24e1d1afa24440 Mon Sep 17 00:00:00 2001 From: Kai Jiang Date: Sun, 12 Jun 2016 03:00:15 -0700 Subject: [PATCH] use first line as the title convention --- R/pkg/R/DataFrame.R | 32 ++++++++++++++++++++------------ R/pkg/R/RDD.R | 6 ++++-- R/pkg/R/WindowSpec.R | 7 ++++--- R/pkg/R/broadcast.R | 8 +++++--- R/pkg/R/column.R | 6 ++++-- R/pkg/R/context.R | 8 +++----- R/pkg/R/group.R | 6 ++++-- R/pkg/R/mllib.R | 24 ++++++++++++++++-------- 8 files changed, 60 insertions(+), 37 deletions(-) diff --git a/R/pkg/R/DataFrame.R b/R/pkg/R/DataFrame.R index faa15de6824b3..96628a491c669 100644 --- a/R/pkg/R/DataFrame.R +++ b/R/pkg/R/DataFrame.R @@ -23,9 +23,11 @@ NULL setOldClass("jobj") setOldClass("structType") -#' @title S4 class that represents a SparkDataFrame -#' @description DataFrames can be created using functions like \link{createDataFrame}, -#' \link{read.json}, \link{table} etc. +#' S4 class that represents a SparkDataFrame +#' +#' DataFrames can be created using functions like \link{createDataFrame}, +#' \link{read.json}, \link{table} etc. +#' #' @family SparkDataFrame functions #' @rdname SparkDataFrame #' @docType class @@ -1940,8 +1942,9 @@ setMethod("join", dataFrame(sdf) }) +#' Merges two data frames +#' #' @name merge -#' @title Merges two data frames #' @param x the first data frame to be joined #' @param y the second data frame to be joined #' @param by a character vector specifying the join columns. If by is not @@ -2111,8 +2114,9 @@ setMethod("unionAll", dataFrame(unioned) }) -#' @title Union two or more SparkDataFrames -#' @description Returns a new SparkDataFrame containing rows of all parameters. +#' Union two or more SparkDataFrames +#' +#' Returns a new SparkDataFrame containing rows of all parameters. #' #' @rdname rbind #' @name rbind @@ -2474,11 +2478,12 @@ setMethod("fillna", dataFrame(sdf) }) +#' Download data from a SparkDataFrame into a data.frame +#' #' This function downloads the contents of a SparkDataFrame into an R's data.frame. #' Since data.frames are held in memory, ensure that you have enough memory #' in your system to accommodate the contents. #' -#' @title Download data from a SparkDataFrame into a data.frame #' @param x a SparkDataFrame #' @return a data.frame #' @family SparkDataFrame functions @@ -2494,13 +2499,14 @@ setMethod("as.data.frame", as.data.frame(collect(x), row.names, optional, ...) }) +#' Attach SparkDataFrame to R search path +#' #' The specified SparkDataFrame is attached to the R search path. This means that #' the SparkDataFrame is searched by R when evaluating a variable, so columns in #' the SparkDataFrame can be accessed by simply giving their names. #' #' @family SparkDataFrame functions #' @rdname attach -#' @title Attach SparkDataFrame to R search path #' @param what (SparkDataFrame) The SparkDataFrame to attach #' @param pos (integer) Specify position in search() where to attach. #' @param name (character) Name to use for the attached SparkDataFrame. Names @@ -2520,7 +2526,7 @@ setMethod("attach", attach(newEnv, pos = pos, name = name, warn.conflicts = warn.conflicts) }) -#' Evaluate an expression in an environment constructed from SparkDataFrame +#' Evaluate a R expression in an environment constructed from a SparkDataFrame #' #' Evaluate a R expression in an environment constructed from a SparkDataFrame #' with() allows access to columns of a SparkDataFrame by simply referring to @@ -2530,7 +2536,6 @@ setMethod("attach", #' #' @rdname with #' @family SparkDataFrame functions -#' @title Evaluate a R expression in an environment constructed from a SparkDataFrame #' @param data (SparkDataFrame) SparkDataFrame to use for constructing an environment. #' @param expr (expression) Expression to evaluate. #' @param ... arguments to be passed to future methods. @@ -2546,10 +2551,12 @@ setMethod("with", eval(substitute(expr), envir = newEnv, enclos = newEnv) }) +#' Compactly display the structure of a dataset +#' #' Display the structure of a SparkDataFrame, including column names, column types, as well as a #' a small sample of rows. +#' #' @name str -#' @title Compactly display the structure of a dataset #' @rdname str #' @family SparkDataFrame functions #' @param object a SparkDataFrame @@ -2662,10 +2669,11 @@ setMethod("drop", base::drop(x) }) +#' Histogram +#' #' This function computes a histogram for a given SparkR Column. #' #' @name histogram -#' @title Histogram #' @param nbins the number of bins (optional). Default value is 10. #' @param df the SparkDataFrame containing the Column to build the histogram from. #' @param colname the name of the column to build the histogram from. diff --git a/R/pkg/R/RDD.R b/R/pkg/R/RDD.R index fded00b40a08c..72a805256523e 100644 --- a/R/pkg/R/RDD.R +++ b/R/pkg/R/RDD.R @@ -19,9 +19,11 @@ setOldClass("jobj") -#' @title S4 class that represents an RDD -#' @description RDD can be created using functions like +#' S4 class that represents an RDD +#' +#' RDD can be created using functions like #' \code{parallelize}, \code{textFile} etc. +#' #' @rdname RDD #' @seealso parallelize, textFile #' @slot env An R environment that stores bookkeeping states of the RDD diff --git a/R/pkg/R/WindowSpec.R b/R/pkg/R/WindowSpec.R index 581176a6c0918..d8405420d0a49 100644 --- a/R/pkg/R/WindowSpec.R +++ b/R/pkg/R/WindowSpec.R @@ -20,9 +20,10 @@ #' @include generics.R jobj.R column.R NULL -#' @title S4 class that represents a WindowSpec -#' @description WindowSpec can be created by using window.partitionBy() -#' or window.orderBy() +#' S4 class that represents a WindowSpec +#' +#' WindowSpec can be created by using window.partitionBy() or window.orderBy() +#' #' @rdname WindowSpec #' @seealso \link{window.partitionBy}, \link{window.orderBy} #' diff --git a/R/pkg/R/broadcast.R b/R/pkg/R/broadcast.R index 38f0eed95e065..398dffc4ab1b4 100644 --- a/R/pkg/R/broadcast.R +++ b/R/pkg/R/broadcast.R @@ -23,9 +23,11 @@ .broadcastValues <- new.env() .broadcastIdToName <- new.env() -# @title S4 class that represents a Broadcast variable -# @description Broadcast variables can be created using the broadcast -# function from a \code{SparkContext}. +# S4 class that represents a Broadcast variable +# +# Broadcast variables can be created using the broadcast +# function from a \code{SparkContext}. +# # @rdname broadcast-class # @seealso broadcast # diff --git a/R/pkg/R/column.R b/R/pkg/R/column.R index 1c195c10633e3..fa5e743ae48b5 100644 --- a/R/pkg/R/column.R +++ b/R/pkg/R/column.R @@ -22,8 +22,10 @@ NULL setOldClass("jobj") -#' @title S4 class that represents a SparkDataFrame column -#' @description The column class supports unary, binary operations on SparkDataFrame columns +#' S4 class that represents a SparkDataFrame column +#' +#' The column class supports unary, binary operations on SparkDataFrame columns +#' #' @rdname column #' #' @slot jc reference to JVM SparkDataFrame column diff --git a/R/pkg/R/context.R b/R/pkg/R/context.R index 0ab1ac14292b6..5c886030ff5c5 100644 --- a/R/pkg/R/context.R +++ b/R/pkg/R/context.R @@ -173,9 +173,8 @@ includePackage <- function(sc, pkg) { .sparkREnv$.packages <- packages } -#' @title Broadcast a variable to all workers +#' Broadcast a variable to all workers #' -#' @description #' Broadcast a read-only variable to the cluster, returning a \code{Broadcast} #' object for reading it in distributed functions. #' @@ -207,7 +206,7 @@ broadcast <- function(sc, object) { Broadcast(id, object, jBroadcast, objName) } -#' @title Set the checkpoint directory +#' Set the checkpoint directory #' #' Set the directory under which RDDs are going to be checkpointed. The #' directory must be a HDFS path if running on a cluster. @@ -226,9 +225,8 @@ setCheckpointDir <- function(sc, dirName) { invisible(callJMethod(sc, "setCheckpointDir", suppressWarnings(normalizePath(dirName)))) } -#' @title Run a function over a list of elements, distributing the computations with Spark. +#' Run a function over a list of elements, distributing the computations with Spark. #' -#' @description #' Applies a function in a manner that is similar to doParallel or lapply to elements of a list. #' The computations are distributed using Spark. It is conceptually the same as the following code: #' lapply(list, func) diff --git a/R/pkg/R/group.R b/R/pkg/R/group.R index 08f4a490c883e..493f0f1b60f26 100644 --- a/R/pkg/R/group.R +++ b/R/pkg/R/group.R @@ -22,8 +22,10 @@ NULL setOldClass("jobj") -#' @title S4 class that represents a GroupedData -#' @description GroupedDatas can be created using groupBy() on a SparkDataFrame +#' S4 class that represents a GroupedData +#' +#' GroupedDatas can be created using groupBy() on a SparkDataFrame +#' #' @rdname GroupedData #' @seealso groupBy #' diff --git a/R/pkg/R/mllib.R b/R/pkg/R/mllib.R index 380e942c12925..440a06646421e 100644 --- a/R/pkg/R/mllib.R +++ b/R/pkg/R/mllib.R @@ -25,22 +25,26 @@ # - a set of methods that reflect the arguments of the other languages supported by Spark. These # methods are prefixed with the `spark.` prefix: spark.glm, spark.kmeans, etc. -#' @title S4 class that represents a generalized linear model +#' S4 class that represents a generalized linear model +#' #' @param jobj a Java object reference to the backing Scala GeneralizedLinearRegressionWrapper #' @export setClass("GeneralizedLinearRegressionModel", representation(jobj = "jobj")) -#' @title S4 class that represents a NaiveBayesModel +#' S4 class that represents a NaiveBayesModel +#' #' @param jobj a Java object reference to the backing Scala NaiveBayesWrapper #' @export setClass("NaiveBayesModel", representation(jobj = "jobj")) -#' @title S4 class that represents a AFTSurvivalRegressionModel +#' S4 class that represents a AFTSurvivalRegressionModel +#' #' @param jobj a Java object reference to the backing Scala AFTSurvivalRegressionWrapper #' @export setClass("AFTSurvivalRegressionModel", representation(jobj = "jobj")) -#' @title S4 class that represents a KMeansModel +#' S4 class that represents a KMeansModel +#' #' @param jobj a Java object reference to the backing Scala KMeansModel #' @export setClass("KMeansModel", representation(jobj = "jobj")) @@ -197,10 +201,11 @@ print.summary.GeneralizedLinearRegressionModel <- function(x, ...) { invisible(x) } +#' predict +#' #' Makes predictions from a generalized linear model produced by glm() or spark.glm(), #' similarly to R's predict(). #' -#' @title predict #' @param object A fitted generalized linear model #' @param newData SparkDataFrame for testing #' @return SparkDataFrame containing predicted labels in a column named "prediction" @@ -217,10 +222,11 @@ setMethod("predict", signature(object = "GeneralizedLinearRegressionModel"), return(dataFrame(callJMethod(object@jobj, "transform", newData@sdf))) }) +#' predict +#' #' Makes predictions from a naive Bayes model or a model produced by spark.naiveBayes(), #' similarly to R package e1071's predict. #' -#' @title predict #' @param object A fitted naive Bayes model #' @param newData SparkDataFrame for testing #' @return SparkDataFrame containing predicted labels in a column named "prediction" @@ -355,9 +361,10 @@ setMethod("summary", signature(object = "KMeansModel"), cluster = cluster, is.loaded = is.loaded)) }) +#' predict +#' #' Makes predictions from a k-means model or a model produced by spark.kmeans(). #' -#' @title predict #' @param object A fitted k-means model #' @param newData SparkDataFrame for testing #' @return SparkDataFrame containing predicted labels in a column named "prediction" @@ -579,10 +586,11 @@ setMethod("summary", signature(object = "AFTSurvivalRegressionModel"), return(list(coefficients = coefficients)) }) +#' predict +#' #' Makes predictions from an AFT survival regression model or a model produced by spark.survreg(), #' similarly to R package survival's predict. #' -#' @title predict #' @param object A fitted AFT survival regression model #' @param newData SparkDataFrame for testing #' @return SparkDataFrame containing predicted labels in a column named "prediction"