aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorFelix Cheung <felixcheung_m@hotmail.com>2016-06-21 11:01:42 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2016-06-21 11:01:42 -0700
commit57746295e6fb705f8393a00ab1cc570ddb7da44e (patch)
treed58255c0bdfeb521978aea9fd5e3e783857d9dd6 /R
parent2d6919bea9fc213b5af530afab7793b63c6c8b51 (diff)
downloadspark-57746295e6fb705f8393a00ab1cc570ddb7da44e.tar.gz
spark-57746295e6fb705f8393a00ab1cc570ddb7da44e.tar.bz2
spark-57746295e6fb705f8393a00ab1cc570ddb7da44e.zip
[SPARK-16109][SPARKR][DOC] R more doc fixes
## What changes were proposed in this pull request? Found these issues while reviewing for SPARK-16090 ## How was this patch tested? roxygen2 doc gen, checked output html Author: Felix Cheung <felixcheung_m@hotmail.com> Closes #13803 from felixcheung/rdocrd.
Diffstat (limited to 'R')
-rw-r--r--R/pkg/R/DataFrame.R7
-rw-r--r--R/pkg/R/functions.R4
-rw-r--r--R/pkg/R/generics.R8
-rw-r--r--R/pkg/R/schema.R7
-rw-r--r--R/pkg/R/stats.R37
5 files changed, 40 insertions, 23 deletions
diff --git a/R/pkg/R/DataFrame.R b/R/pkg/R/DataFrame.R
index a8ade1ac9a..ed0bb85f43 100644
--- a/R/pkg/R/DataFrame.R
+++ b/R/pkg/R/DataFrame.R
@@ -59,6 +59,7 @@ setMethod("initialize", "SparkDataFrame", function(.Object, sdf, isCached) {
#' @export
#' @param sdf A Java object reference to the backing Scala DataFrame
#' @param isCached TRUE if the SparkDataFrame is cached
+#' @noRd
dataFrame <- function(sdf, isCached = FALSE) {
new("SparkDataFrame", sdf, isCached)
}
@@ -119,7 +120,7 @@ setMethod("schema",
#' Print the logical and physical Catalyst plans to the console for debugging.
#'
#' @param x A SparkDataFrame
-#' @param extended Logical. If extended is False, explain() only prints the physical plan.
+#' @param extended Logical. If extended is FALSE, explain() only prints the physical plan.
#' @family SparkDataFrame functions
#' @rdname explain
#' @name explain
@@ -175,6 +176,8 @@ setMethod("isLocal",
#'
#' @param x A SparkDataFrame
#' @param numRows The number of rows to print. Defaults to 20.
+#' @param truncate Whether truncate long strings. If true, strings more than 20 characters will be
+#' truncated and all cells will be aligned right
#'
#' @family SparkDataFrame functions
#' @rdname showDF
@@ -1854,7 +1857,7 @@ setMethod("withColumnRenamed",
select(x, cols)
})
-#' @param newColPair A named pair of the form new_column_name = existing_column
+#' @param ... A named pair of the form new_column_name = existing_column
#' @rdname rename
#' @name rename
#' @export
diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R
index 6e0009f7c9..09e5afa970 100644
--- a/R/pkg/R/functions.R
+++ b/R/pkg/R/functions.R
@@ -1777,7 +1777,7 @@ setMethod("months_between", signature(y = "Column"),
#' nanvl
#'
#' Returns col1 if it is not NaN, or col2 if col1 is NaN.
-#' hhBoth inputs should be floating point columns (DoubleType or FloatType).
+#' Both inputs should be floating point columns (DoubleType or FloatType).
#'
#' @rdname nanvl
#' @name nanvl
@@ -2008,6 +2008,8 @@ setMethod("from_utc_timestamp", signature(y = "Column", x = "character"),
#' NOTE: The position is not zero based, but 1 based index, returns 0 if substr
#' could not be found in str.
#'
+#' @param y column to check
+#' @param x substring to check
#' @family string_funcs
#' @rdname instr
#' @name instr
diff --git a/R/pkg/R/generics.R b/R/pkg/R/generics.R
index 43395aaa1d..7b08a8ee66 100644
--- a/R/pkg/R/generics.R
+++ b/R/pkg/R/generics.R
@@ -59,15 +59,15 @@ setGeneric("count", function(x) { standardGeneric("count") })
# @export
setGeneric("countByValue", function(x) { standardGeneric("countByValue") })
-# @rdname statfunctions
+# @rdname crosstab
# @export
setGeneric("crosstab", function(x, col1, col2) { standardGeneric("crosstab") })
-# @rdname statfunctions
+# @rdname freqItems
# @export
setGeneric("freqItems", function(x, cols, support = 0.01) { standardGeneric("freqItems") })
-# @rdname statfunctions
+# @rdname approxQuantile
# @export
setGeneric("approxQuantile",
function(x, col, probabilities, relativeError) {
@@ -575,7 +575,7 @@ setGeneric("sample",
setGeneric("sample_frac",
function(x, withReplacement, fraction, seed) { standardGeneric("sample_frac") })
-#' @rdname statfunctions
+#' @rdname sampleBy
#' @export
setGeneric("sampleBy", function(x, col, fractions, seed) { standardGeneric("sampleBy") })
diff --git a/R/pkg/R/schema.R b/R/pkg/R/schema.R
index fb23c780ad..a91e9980df 100644
--- a/R/pkg/R/schema.R
+++ b/R/pkg/R/schema.R
@@ -86,9 +86,8 @@ print.structType <- function(x, ...) {
#' Create a structField object that contains the metadata for a single field in a schema.
#'
#' @param x The name of the field
-#' @param type The data type of the field
-#' @param nullable A logical vector indicating whether or not the field is nullable
#' @return a structField object
+#' @rdname structField
#' @export
#' @examples
#'\dontrun{
@@ -176,6 +175,10 @@ checkType <- function(type) {
stop(paste("Unsupported type for SparkDataframe:", type))
}
+#' @param type The data type of the field
+#' @param nullable A logical vector indicating whether or not the field is nullable
+#' @rdname structField
+#' @export
structField.character <- function(x, type, nullable = TRUE) {
if (class(x) != "character") {
stop("Field name must be a string.")
diff --git a/R/pkg/R/stats.R b/R/pkg/R/stats.R
index e40b1773d7..c92352e1b0 100644
--- a/R/pkg/R/stats.R
+++ b/R/pkg/R/stats.R
@@ -19,10 +19,9 @@
setOldClass("jobj")
-#' @title SparkDataFrame statistic functions
-
-#' @description
-#' crosstab - Computes a pair-wise frequency table of the given columns. Also known as a contingency
+#' Computes a pair-wise frequency table of the given columns
+#'
+#' Computes a pair-wise frequency table of the given columns. Also known as a contingency
#' table. The number of distinct values for each column should be less than 1e4. At most 1e6
#' non-zero pair frequencies will be returned.
#'
@@ -33,8 +32,9 @@ setOldClass("jobj")
#' of `col2`. The name of the first column will be `$col1_$col2`. Pairs that have no
#' occurrences will have zero as their counts.
#'
-#' @rdname statfunctions
+#' @rdname crosstab
#' @name crosstab
+#' @family stat functions
#' @export
#' @examples
#' \dontrun{
@@ -59,6 +59,7 @@ setMethod("crosstab",
#'
#' @rdname cov
#' @name cov
+#' @family stat functions
#' @export
#' @examples
#'\dontrun{
@@ -87,6 +88,7 @@ setMethod("cov",
#'
#' @rdname corr
#' @name corr
+#' @family stat functions
#' @export
#' @examples
#'\dontrun{
@@ -103,8 +105,10 @@ setMethod("corr",
callJMethod(statFunctions, "corr", col1, col2, method)
})
-#' @description
-#' freqItems - Finding frequent items for columns, possibly with false positives.
+
+#' Finding frequent items for columns, possibly with false positives
+#'
+#' Finding frequent items for columns, possibly with false positives.
#' Using the frequent element count algorithm described in
#' \url{http://dx.doi.org/10.1145/762471.762473}, proposed by Karp, Schenker, and Papadimitriou.
#'
@@ -114,8 +118,9 @@ setMethod("corr",
#' Should be greater than 1e-4. Default support = 0.01.
#' @return a local R data.frame with the frequent items in each column
#'
-#' @rdname statfunctions
+#' @rdname freqItems
#' @name freqItems
+#' @family stat functions
#' @export
#' @examples
#' \dontrun{
@@ -130,8 +135,9 @@ setMethod("freqItems", signature(x = "SparkDataFrame", cols = "character"),
collect(dataFrame(sct))
})
-#' @description
-#' approxQuantile - Calculates the approximate quantiles of a numerical column of a SparkDataFrame.
+#' Calculates the approximate quantiles of a numerical column of a SparkDataFrame
+#'
+#' Calculates the approximate quantiles of a numerical column of a SparkDataFrame.
#' The result of this algorithm has the following deterministic bound:
#' If the SparkDataFrame has N elements and if we request the quantile at probability `p` up to
#' error `err`, then the algorithm will return a sample `x` from the SparkDataFrame so that the
@@ -150,8 +156,9 @@ setMethod("freqItems", signature(x = "SparkDataFrame", cols = "character"),
#' Note that values greater than 1 are accepted but give the same result as 1.
#' @return The approximate quantiles at the given probabilities.
#'
-#' @rdname statfunctions
+#' @rdname approxQuantile
#' @name approxQuantile
+#' @family stat functions
#' @export
#' @examples
#' \dontrun{
@@ -168,8 +175,9 @@ setMethod("approxQuantile",
as.list(probabilities), relativeError)
})
-#' @description
-#' sampleBy - Returns a stratified sample without replacement based on the fraction given on each
+#' Returns a stratified sample without replacement
+#'
+#' Returns a stratified sample without replacement based on the fraction given on each
#' stratum.
#'
#' @param x A SparkDataFrame
@@ -179,8 +187,9 @@ setMethod("approxQuantile",
#' @param seed random seed
#' @return A new SparkDataFrame that represents the stratified sample
#'
-#' @rdname statfunctions
+#' @rdname sampleBy
#' @name sampleBy
+#' @family stat functions
#' @export
#' @examples
#'\dontrun{