Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0F823200B16 for ; Mon, 20 Jun 2016 23:24:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0DFB8160A55; Mon, 20 Jun 2016 21:24:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DB266160A26 for ; Mon, 20 Jun 2016 23:24:45 +0200 (CEST) Received: (qmail 77128 invoked by uid 500); 20 Jun 2016 21:24:45 -0000 Mailing-List: contact commits-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@spark.apache.org Received: (qmail 77050 invoked by uid 99); 20 Jun 2016 21:24:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2016 21:24:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CE901DFE65; Mon, 20 Jun 2016 21:24:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: shivaram@apache.org To: commits@spark.apache.org Date: Mon, 20 Jun 2016 21:24:45 -0000 Message-Id: <93f607467c814991902b5c13ca8c09c4@git.apache.org> In-Reply-To: <663bdc908c1d4c7ba916a40edcc3854e@git.apache.org> References: <663bdc908c1d4c7ba916a40edcc3854e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] spark git commit: [SPARK-14995][R] Add `since` tag in Roxygen documentation for SparkR API methods archived-at: Mon, 20 Jun 2016 21:24:48 -0000 [SPARK-14995][R] Add `since` tag in Roxygen documentation for SparkR API methods ## What changes were proposed in this pull request? This PR adds `since` tags to Roxygen documentation according to the previous documentation archive. https://home.apache.org/~dongjoon/spark-2.0.0-docs/api/R/ ## How was this patch tested? Manual. Author: Dongjoon Hyun Closes #13734 from dongjoon-hyun/SPARK-14995. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d0eddb80 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d0eddb80 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d0eddb80 Branch: refs/heads/master Commit: d0eddb80eca04e4f5f8af3b5143096cf67200277 Parents: 9251423 Author: Dongjoon Hyun Authored: Mon Jun 20 14:24:41 2016 -0700 Committer: Shivaram Venkataraman Committed: Mon Jun 20 14:24:41 2016 -0700 ---------------------------------------------------------------------- R/pkg/R/DataFrame.R | 93 +++++++++++++++++++++++++++- R/pkg/R/SQLContext.R | 42 ++++++------- R/pkg/R/WindowSpec.R | 8 +++ R/pkg/R/column.R | 10 +++ R/pkg/R/context.R | 3 +- R/pkg/R/functions.R | 153 ++++++++++++++++++++++++++++++++++++++++++++++ R/pkg/R/group.R | 6 ++ R/pkg/R/jobj.R | 1 + R/pkg/R/mllib.R | 24 ++++++++ R/pkg/R/schema.R | 5 +- R/pkg/R/sparkR.R | 18 +++--- R/pkg/R/stats.R | 6 ++ R/pkg/R/utils.R | 1 + R/pkg/R/window.R | 4 ++ 14 files changed, 340 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/DataFrame.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/DataFrame.R b/R/pkg/R/DataFrame.R index 583d3ae..ecdcd6e 100644 --- a/R/pkg/R/DataFrame.R +++ b/R/pkg/R/DataFrame.R @@ -25,7 +25,7 @@ setOldClass("structType") #' S4 class that represents a SparkDataFrame #' -#' DataFrames can be created using functions like \link{createDataFrame}, +#' SparkDataFrames can be created using functions like \link{createDataFrame}, #' \link{read.json}, \link{table} etc. #' #' @family SparkDataFrame functions @@ -42,6 +42,7 @@ setOldClass("structType") #' sparkR.session() #' df <- createDataFrame(faithful) #'} +#' @note SparkDataFrame since 2.0.0 setClass("SparkDataFrame", slots = list(env = "environment", sdf = "jobj")) @@ -81,6 +82,7 @@ dataFrame <- function(sdf, isCached = FALSE) { #' df <- read.json(path) #' printSchema(df) #'} +#' @note printSchema since 1.4.0 setMethod("printSchema", signature(x = "SparkDataFrame"), function(x) { @@ -105,6 +107,7 @@ setMethod("printSchema", #' df <- read.json(path) #' dfSchema <- schema(df) #'} +#' @note schema since 1.4.0 setMethod("schema", signature(x = "SparkDataFrame"), function(x) { @@ -128,6 +131,7 @@ setMethod("schema", #' df <- read.json(path) #' explain(df, TRUE) #'} +#' @note explain since 1.4.0 setMethod("explain", signature(x = "SparkDataFrame"), function(x, extended = FALSE) { @@ -158,6 +162,7 @@ setMethod("explain", #' df <- read.json(path) #' isLocal(df) #'} +#' @note isLocal since 1.4.0 setMethod("isLocal", signature(x = "SparkDataFrame"), function(x) { @@ -182,6 +187,7 @@ setMethod("isLocal", #' df <- read.json(path) #' showDF(df) #'} +#' @note showDF since 1.4.0 setMethod("showDF", signature(x = "SparkDataFrame"), function(x, numRows = 20, truncate = TRUE) { @@ -206,6 +212,7 @@ setMethod("showDF", #' df <- read.json(path) #' df #'} +#' @note show(SparkDataFrame) since 1.4.0 setMethod("show", "SparkDataFrame", function(object) { cols <- lapply(dtypes(object), function(l) { @@ -232,6 +239,7 @@ setMethod("show", "SparkDataFrame", #' df <- read.json(path) #' dtypes(df) #'} +#' @note dtypes since 1.4.0 setMethod("dtypes", signature(x = "SparkDataFrame"), function(x) { @@ -259,6 +267,7 @@ setMethod("dtypes", #' columns(df) #' colnames(df) #'} +#' @note columns since 1.4.0 setMethod("columns", signature(x = "SparkDataFrame"), function(x) { @@ -269,6 +278,7 @@ setMethod("columns", #' @rdname columns #' @name names +#' @note names since 1.5.0 setMethod("names", signature(x = "SparkDataFrame"), function(x) { @@ -277,6 +287,7 @@ setMethod("names", #' @rdname columns #' @name names<- +#' @note names<- since 1.5.0 setMethod("names<-", signature(x = "SparkDataFrame"), function(x, value) { @@ -288,6 +299,7 @@ setMethod("names<-", #' @rdname columns #' @name colnames +#' @note colnames since 1.6.0 setMethod("colnames", signature(x = "SparkDataFrame"), function(x) { @@ -296,6 +308,7 @@ setMethod("colnames", #' @rdname columns #' @name colnames<- +#' @note colnames<- since 1.6.0 setMethod("colnames<-", signature(x = "SparkDataFrame"), function(x, value) { @@ -338,6 +351,7 @@ setMethod("colnames<-", #' irisDF <- createDataFrame(iris) #' coltypes(irisDF) #'} +#' @note coltypes since 1.6.0 setMethod("coltypes", signature(x = "SparkDataFrame"), function(x) { @@ -393,6 +407,7 @@ setMethod("coltypes", #' coltypes(df) <- c("character", "integer") #' coltypes(df) <- c(NA, "numeric") #'} +#' @note coltypes<- since 1.6.0 setMethod("coltypes<-", signature(x = "SparkDataFrame", value = "character"), function(x, value) { @@ -440,6 +455,7 @@ setMethod("coltypes<-", #' createOrReplaceTempView(df, "json_df") #' new_df <- sql("SELECT * FROM json_df") #'} +#' @note createOrReplaceTempView since 2.0.0 setMethod("createOrReplaceTempView", signature(x = "SparkDataFrame", viewName = "character"), function(x, viewName) { @@ -464,6 +480,7 @@ setMethod("createOrReplaceTempView", #' registerTempTable(df, "json_df") #' new_df <- sql("SELECT * FROM json_df") #'} +#' @note registerTempTable since 1.4.0 setMethod("registerTempTable", signature(x = "SparkDataFrame", tableName = "character"), function(x, tableName) { @@ -492,6 +509,7 @@ setMethod("registerTempTable", #' createOrReplaceTempView(df, "table1") #' insertInto(df2, "table1", overwrite = TRUE) #'} +#' @note insertInto since 1.4.0 setMethod("insertInto", signature(x = "SparkDataFrame", tableName = "character"), function(x, tableName, overwrite = FALSE) { @@ -518,6 +536,7 @@ setMethod("insertInto", #' df <- read.json(path) #' cache(df) #'} +#' @note cache since 1.4.0 setMethod("cache", signature(x = "SparkDataFrame"), function(x) { @@ -545,6 +564,7 @@ setMethod("cache", #' df <- read.json(path) #' persist(df, "MEMORY_AND_DISK") #'} +#' @note persist since 1.4.0 setMethod("persist", signature(x = "SparkDataFrame", newLevel = "character"), function(x, newLevel) { @@ -573,6 +593,7 @@ setMethod("persist", #' persist(df, "MEMORY_AND_DISK") #' unpersist(df) #'} +#' @note unpersist since 1.4.0 setMethod("unpersist", signature(x = "SparkDataFrame"), function(x, blocking = TRUE) { @@ -609,6 +630,7 @@ setMethod("unpersist", #' newDF <- repartition(df, col = df$"col1", df$"col2") #' newDF <- repartition(df, 3L, col = df$"col1", df$"col2") #'} +#' @note repartition since 1.4.0 setMethod("repartition", signature(x = "SparkDataFrame"), function(x, numPartitions = NULL, col = NULL, ...) { @@ -675,6 +697,7 @@ setMethod("toJSON", #' df <- read.json(path) #' write.json(df, "/tmp/sparkr-tmp/") #'} +#' @note write.json since 1.6.0 setMethod("write.json", signature(x = "SparkDataFrame", path = "character"), function(x, path) { @@ -729,6 +752,7 @@ setMethod("write.orc", #' write.parquet(df, "/tmp/sparkr-tmp1/") #' saveAsParquetFile(df, "/tmp/sparkr-tmp2/") #'} +#' @note write.parquet since 1.6.0 setMethod("write.parquet", signature(x = "SparkDataFrame", path = "character"), function(x, path) { @@ -739,6 +763,7 @@ setMethod("write.parquet", #' @rdname write.parquet #' @name saveAsParquetFile #' @export +#' @note saveAsParquetFile since 1.4.0 setMethod("saveAsParquetFile", signature(x = "SparkDataFrame", path = "character"), function(x, path) { @@ -766,6 +791,7 @@ setMethod("saveAsParquetFile", #' df <- read.text(path) #' write.text(df, "/tmp/sparkr-tmp/") #'} +#' @note write.text since 2.0.0 setMethod("write.text", signature(x = "SparkDataFrame", path = "character"), function(x, path) { @@ -790,6 +816,7 @@ setMethod("write.text", #' df <- read.json(path) #' distinctDF <- distinct(df) #'} +#' @note distinct since 1.4.0 setMethod("distinct", signature(x = "SparkDataFrame"), function(x) { @@ -799,6 +826,7 @@ setMethod("distinct", #' @rdname distinct #' @name unique +#' @note unique since 1.5.0 setMethod("unique", signature(x = "SparkDataFrame"), function(x) { @@ -826,6 +854,7 @@ setMethod("unique", #' collect(sample(df, FALSE, 0.5)) #' collect(sample(df, TRUE, 0.5)) #'} +#' @note sample since 1.4.0 setMethod("sample", signature(x = "SparkDataFrame", withReplacement = "logical", fraction = "numeric"), @@ -843,6 +872,7 @@ setMethod("sample", #' @rdname sample #' @name sample_frac +#' @note sample_frac since 1.4.0 setMethod("sample_frac", signature(x = "SparkDataFrame", withReplacement = "logical", fraction = "numeric"), @@ -865,6 +895,7 @@ setMethod("sample_frac", #' df <- read.json(path) #' count(df) #' } +#' @note count since 1.4.0 setMethod("count", signature(x = "SparkDataFrame"), function(x) { @@ -873,6 +904,7 @@ setMethod("count", #' @name nrow #' @rdname nrow +#' @note nrow since 1.5.0 setMethod("nrow", signature(x = "SparkDataFrame"), function(x) { @@ -894,6 +926,7 @@ setMethod("nrow", #' df <- read.json(path) #' ncol(df) #' } +#' @note ncol since 1.5.0 setMethod("ncol", signature(x = "SparkDataFrame"), function(x) { @@ -916,6 +949,7 @@ setMethod("ncol", #' df <- read.json(path) #' dim(df) #' } +#' @note dim since 1.5.0 setMethod("dim", signature(x = "SparkDataFrame"), function(x) { @@ -940,6 +974,7 @@ setMethod("dim", #' collected <- collect(df) #' firstName <- collected[[1]]$name #' } +#' @note collect since 1.4.0 setMethod("collect", signature(x = "SparkDataFrame"), function(x, stringsAsFactors = FALSE) { @@ -1010,6 +1045,7 @@ setMethod("collect", #' df <- read.json(path) #' limitedDF <- limit(df, 10) #' } +#' @note limit since 1.4.0 setMethod("limit", signature(x = "SparkDataFrame", num = "numeric"), function(x, num) { @@ -1030,6 +1066,7 @@ setMethod("limit", #' df <- read.json(path) #' take(df, 2) #' } +#' @note take since 1.4.0 setMethod("take", signature(x = "SparkDataFrame", num = "numeric"), function(x, num) { @@ -1058,6 +1095,7 @@ setMethod("take", #' df <- read.json(path) #' head(df) #' } +#' @note head since 1.4.0 setMethod("head", signature(x = "SparkDataFrame"), function(x, num = 6L) { @@ -1080,6 +1118,7 @@ setMethod("head", #' df <- read.json(path) #' first(df) #' } +#' @note first(SparkDataFrame) since 1.4.0 setMethod("first", signature(x = "SparkDataFrame"), function(x) { @@ -1131,6 +1170,7 @@ setMethod("toRDD", #' # Compute the max age and average salary, grouped by department and gender. #' agg(groupBy(df, "department", "gender"), salary="avg", "age" -> "max") #' } +#' @note groupBy since 1.4.0 setMethod("groupBy", signature(x = "SparkDataFrame"), function(x, ...) { @@ -1146,6 +1186,7 @@ setMethod("groupBy", #' @rdname groupBy #' @name group_by +#' @note group_by since 1.4.0 setMethod("group_by", signature(x = "SparkDataFrame"), function(x, ...) { @@ -1161,6 +1202,7 @@ setMethod("group_by", #' @rdname agg #' @name agg #' @export +#' @note agg since 1.4.0 setMethod("agg", signature(x = "SparkDataFrame"), function(x, ...) { @@ -1169,6 +1211,7 @@ setMethod("agg", #' @rdname agg #' @name summarize +#' @note summarize since 1.4.0 setMethod("summarize", signature(x = "SparkDataFrame"), function(x, ...) { @@ -1233,6 +1276,7 @@ dapplyInternal <- function(x, func, schema) { #' # 1 2 2 2 3 #' # 2 3 3 3 4 #' } +#' @note dapply since 2.0.0 setMethod("dapply", signature(x = "SparkDataFrame", func = "function", schema = "structType"), function(x, func, schema) { @@ -1273,6 +1317,7 @@ setMethod("dapply", #' # 2 2 2 3 #' # 3 3 3 4 #' } +#' @note dapplyCollect since 2.0.0 setMethod("dapplyCollect", signature(x = "SparkDataFrame", func = "function"), function(x, func) { @@ -1361,6 +1406,7 @@ setMethod("dapplyCollect", #' 3 2.351890 0.6548350 0.2375602 0.2521257 #' #'} +#' @note gapply(SparkDataFrame) since 2.0.0 setMethod("gapply", signature(x = "SparkDataFrame"), function(x, cols, func, schema) { @@ -1444,6 +1490,7 @@ getColumn <- function(x, c) { #' @rdname select #' @name $ +#' @note $ since 1.4.0 setMethod("$", signature(x = "SparkDataFrame"), function(x, name) { getColumn(x, name) @@ -1451,6 +1498,7 @@ setMethod("$", signature(x = "SparkDataFrame"), #' @rdname select #' @name $<- +#' @note $<- since 1.4.0 setMethod("$<-", signature(x = "SparkDataFrame"), function(x, name, value) { stopifnot(class(value) == "Column" || is.null(value)) @@ -1468,6 +1516,7 @@ setClassUnion("numericOrcharacter", c("numeric", "character")) #' @rdname subset #' @name [[ +#' @note [[ since 1.4.0 setMethod("[[", signature(x = "SparkDataFrame", i = "numericOrcharacter"), function(x, i) { if (is.numeric(i)) { @@ -1479,6 +1528,7 @@ setMethod("[[", signature(x = "SparkDataFrame", i = "numericOrcharacter"), #' @rdname subset #' @name [ +#' @note [ since 1.4.0 setMethod("[", signature(x = "SparkDataFrame"), function(x, i, j, ..., drop = F) { # Perform filtering first if needed @@ -1543,6 +1593,7 @@ setMethod("[", signature(x = "SparkDataFrame"), #' subset(df, df$age %in% c(19), select = c(1,2)) #' subset(df, select = c(1,2)) #' } +#' @note subset since 1.5.0 setMethod("subset", signature(x = "SparkDataFrame"), function(x, subset, select, drop = F, ...) { if (missing(subset)) { @@ -1573,6 +1624,7 @@ setMethod("subset", signature(x = "SparkDataFrame"), #' # Similar to R data frames columns can also be selected using `$` #' df[,df$age] #' } +#' @note select(SparkDataFrame, character) since 1.4.0 setMethod("select", signature(x = "SparkDataFrame", col = "character"), function(x, col, ...) { if (length(col) > 1) { @@ -1590,6 +1642,7 @@ setMethod("select", signature(x = "SparkDataFrame", col = "character"), #' @family SparkDataFrame functions #' @rdname select #' @export +#' @note select(SparkDataFrame, Column) since 1.4.0 setMethod("select", signature(x = "SparkDataFrame", col = "Column"), function(x, col, ...) { jcols <- lapply(list(col, ...), function(c) { @@ -1602,6 +1655,7 @@ setMethod("select", signature(x = "SparkDataFrame", col = "Column"), #' @family SparkDataFrame functions #' @rdname select #' @export +#' @note select(SparkDataFrame, list) since 1.4.0 setMethod("select", signature(x = "SparkDataFrame", col = "list"), function(x, col) { @@ -1635,6 +1689,7 @@ setMethod("select", #' df <- read.json(path) #' selectExpr(df, "col1", "(col2 * 5) as newCol") #' } +#' @note selectExpr since 1.4.0 setMethod("selectExpr", signature(x = "SparkDataFrame", expr = "character"), function(x, expr, ...) { @@ -1666,6 +1721,7 @@ setMethod("selectExpr", #' # Replace an existing column #' newDF2 <- withColumn(newDF, "newCol", newDF$col1) #' } +#' @note withColumn since 1.4.0 setMethod("withColumn", signature(x = "SparkDataFrame", colName = "character", col = "Column"), function(x, colName, col) { @@ -1698,6 +1754,7 @@ setMethod("withColumn", #' # Replace the "age" column #' df1 <- mutate(df, age = df$age + 1L) #' } +#' @note mutate since 1.4.0 setMethod("mutate", signature(.data = "SparkDataFrame"), function(.data, ...) { @@ -1756,6 +1813,7 @@ setMethod("mutate", #' @export #' @rdname mutate #' @name transform +#' @note transform since 1.5.0 setMethod("transform", signature(`_data` = "SparkDataFrame"), function(`_data`, ...) { @@ -1782,6 +1840,7 @@ setMethod("transform", #' df <- read.json(path) #' newDF <- withColumnRenamed(df, "col1", "newCol1") #' } +#' @note withColumnRenamed since 1.4.0 setMethod("withColumnRenamed", signature(x = "SparkDataFrame", existingCol = "character", newCol = "character"), function(x, existingCol, newCol) { @@ -1806,6 +1865,7 @@ setMethod("withColumnRenamed", #' df <- read.json(path) #' newDF <- rename(df, col1 = df$newCol1) #' } +#' @note rename since 1.4.0 setMethod("rename", signature(x = "SparkDataFrame"), function(x, ...) { @@ -1852,6 +1912,7 @@ setClassUnion("characterOrColumn", c("character", "Column")) #' arrange(df, "col1", decreasing = TRUE) #' arrange(df, "col1", "col2", decreasing = c(TRUE, FALSE)) #' } +#' @note arrange(SparkDataFrame, Column) since 1.4.0 setMethod("arrange", signature(x = "SparkDataFrame", col = "Column"), function(x, col, ...) { @@ -1866,6 +1927,7 @@ setMethod("arrange", #' @rdname arrange #' @name arrange #' @export +#' @note arrange(SparkDataFrame, character) since 1.4.0 setMethod("arrange", signature(x = "SparkDataFrame", col = "character"), function(x, col, ..., decreasing = FALSE) { @@ -1898,6 +1960,7 @@ setMethod("arrange", #' @rdname arrange #' @name orderBy #' @export +#' @note orderBy(SparkDataFrame, characterOrColumn) since 1.4.0 setMethod("orderBy", signature(x = "SparkDataFrame", col = "characterOrColumn"), function(x, col, ...) { @@ -1925,6 +1988,7 @@ setMethod("orderBy", #' filter(df, "col1 > 0") #' filter(df, df$col2 != "abcdefg") #' } +#' @note filter since 1.4.0 setMethod("filter", signature(x = "SparkDataFrame", condition = "characterOrColumn"), function(x, condition) { @@ -1938,6 +2002,7 @@ setMethod("filter", #' @family SparkDataFrame functions #' @rdname filter #' @name where +#' @note where since 1.4.0 setMethod("where", signature(x = "SparkDataFrame", condition = "characterOrColumn"), function(x, condition) { @@ -1966,6 +2031,7 @@ setMethod("where", #' dropDuplicates(df, "col1", "col2") #' dropDuplicates(df, c("col1", "col2")) #' } +#' @note dropDuplicates since 2.0.0 setMethod("dropDuplicates", signature(x = "SparkDataFrame"), function(x, ...) { @@ -2012,6 +2078,7 @@ setMethod("dropDuplicates", #' join(df1, df2, df1$col1 == df2$col2) # Performs an inner join based on expression #' join(df1, df2, df1$col1 == df2$col2, "right_outer") #' } +#' @note join since 1.4.0 setMethod("join", signature(x = "SparkDataFrame", y = "SparkDataFrame"), function(x, y, joinExpr = NULL, joinType = NULL) { @@ -2073,6 +2140,7 @@ setMethod("join", #' merge(df1, df2, by.x = "col1", by.y = "col2", all = TRUE, sort = FALSE) #' merge(df1, df2, by = "col1", all = TRUE, suffixes = c("-X", "-Y")) #' } +#' @note merge since 1.5.0 setMethod("merge", signature(x = "SparkDataFrame", y = "SparkDataFrame"), function(x, y, by = intersect(names(x), names(y)), by.x = by, by.y = by, @@ -2160,6 +2228,7 @@ setMethod("merge", #' @param suffix a suffix for the column name #' @return list of columns #' +#' @note generateAliasesForIntersectedCols since 1.6.0 generateAliasesForIntersectedCols <- function (x, intersectedColNames, suffix) { allColNames <- names(x) # sets alias for making colnames unique in dataframe 'x' @@ -2198,6 +2267,7 @@ generateAliasesForIntersectedCols <- function (x, intersectedColNames, suffix) { #' df2 <- read.json(path2) #' unioned <- unionAll(df, df2) #' } +#' @note unionAll since 1.4.0 setMethod("unionAll", signature(x = "SparkDataFrame", y = "SparkDataFrame"), function(x, y) { @@ -2212,6 +2282,7 @@ setMethod("unionAll", #' @rdname rbind #' @name rbind #' @export +#' @note rbind since 1.5.0 setMethod("rbind", signature(... = "SparkDataFrame"), function(x, ..., deparse.level = 1) { @@ -2241,6 +2312,7 @@ setMethod("rbind", #' df2 <- read.json(path2) #' intersectDF <- intersect(df, df2) #' } +#' @note intersect since 1.4.0 setMethod("intersect", signature(x = "SparkDataFrame", y = "SparkDataFrame"), function(x, y) { @@ -2269,6 +2341,7 @@ setMethod("intersect", #' } #' @rdname except #' @export +#' @note except since 1.4.0 setMethod("except", signature(x = "SparkDataFrame", y = "SparkDataFrame"), function(x, y) { @@ -2310,6 +2383,7 @@ setMethod("except", #' write.df(df, "myfile", "parquet", "overwrite") #' saveDF(df, parquetPath2, "parquet", mode = saveMode, mergeSchema = mergeSchema) #' } +#' @note write.df since 1.4.0 setMethod("write.df", signature(df = "SparkDataFrame", path = "character"), function(df, path, source = NULL, mode = "error", ...){ @@ -2330,6 +2404,7 @@ setMethod("write.df", #' @rdname write.df #' @name saveDF #' @export +#' @note saveDF since 1.4.0 setMethod("saveDF", signature(df = "SparkDataFrame", path = "character"), function(df, path, source = NULL, mode = "error", ...){ @@ -2367,6 +2442,7 @@ setMethod("saveDF", #' df <- read.json(path) #' saveAsTable(df, "myfile") #' } +#' @note saveAsTable since 1.4.0 setMethod("saveAsTable", signature(df = "SparkDataFrame", tableName = "character"), function(df, tableName, source = NULL, mode="error", ...){ @@ -2405,6 +2481,7 @@ setMethod("saveAsTable", #' describe(df, "col1") #' describe(df, "col1", "col2") #' } +#' @note describe(SparkDataFrame, character) since 1.4.0 setMethod("describe", signature(x = "SparkDataFrame", col = "character"), function(x, col, ...) { @@ -2415,6 +2492,7 @@ setMethod("describe", #' @rdname summary #' @name describe +#' @note describe(SparkDataFrame) since 1.4.0 setMethod("describe", signature(x = "SparkDataFrame"), function(x) { @@ -2425,6 +2503,7 @@ setMethod("describe", #' @rdname summary #' @name summary +#' @note summary(SparkDataFrame) since 1.5.0 setMethod("summary", signature(object = "SparkDataFrame"), function(object, ...) { @@ -2458,6 +2537,7 @@ setMethod("summary", #' df <- read.json(path) #' dropna(df) #' } +#' @note dropna since 1.4.0 setMethod("dropna", signature(x = "SparkDataFrame"), function(x, how = c("any", "all"), minNonNulls = NULL, cols = NULL) { @@ -2478,6 +2558,7 @@ setMethod("dropna", #' @rdname nafunctions #' @name na.omit #' @export +#' @note na.omit since 1.5.0 setMethod("na.omit", signature(object = "SparkDataFrame"), function(object, how = c("any", "all"), minNonNulls = NULL, cols = NULL) { @@ -2512,6 +2593,7 @@ setMethod("na.omit", #' fillna(df, 1) #' fillna(df, list("age" = 20, "name" = "unknown")) #' } +#' @note fillna since 1.4.0 setMethod("fillna", signature(x = "SparkDataFrame"), function(x, value, cols = NULL) { @@ -2571,6 +2653,7 @@ setMethod("fillna", #' irisDF <- createDataFrame(iris) #' df <- as.data.frame(irisDF[irisDF$Species == "setosa", ]) #' } +#' @note as.data.frame since 1.6.0 setMethod("as.data.frame", signature(x = "SparkDataFrame"), function(x, row.names = NULL, optional = FALSE, ...) { @@ -2597,6 +2680,7 @@ setMethod("as.data.frame", #' summary(Sepal_Width) #' } #' @seealso \link{detach} +#' @note attach since 1.6.0 setMethod("attach", signature(what = "SparkDataFrame"), function(what, pos = 2, name = deparse(substitute(what)), warn.conflicts = TRUE) { @@ -2622,6 +2706,7 @@ setMethod("attach", #' with(irisDf, nrow(Sepal_Width)) #' } #' @seealso \link{attach} +#' @note with since 1.6.0 setMethod("with", signature(data = "SparkDataFrame"), function(data, expr, ...) { @@ -2645,6 +2730,7 @@ setMethod("with", #' # Show the structure of the SparkDataFrame #' str(irisDF) #' } +#' @note str since 1.6.1 setMethod("str", signature(object = "SparkDataFrame"), function(object) { @@ -2726,6 +2812,7 @@ setMethod("str", #' drop(df, c("col1", "col2")) #' drop(df, df$col1) #' } +#' @note drop since 2.0.0 setMethod("drop", signature(x = "SparkDataFrame"), function(x, col) { @@ -2775,6 +2862,7 @@ setMethod("drop", #' geom_bar(stat = "identity") + #' xlab("Sepal_Length") + ylab("Frequency") #' } +#' @note histogram since 2.0.0 setMethod("histogram", signature(df = "SparkDataFrame", col = "characterOrColumn"), function(df, col, nbins = 10) { @@ -2896,6 +2984,7 @@ setMethod("histogram", #' jdbcUrl <- "jdbc:mysql://localhost:3306/databasename" #' write.jdbc(df, jdbcUrl, "table", user = "username", password = "password") #' } +#' @note write.jdbc since 2.0.0 setMethod("write.jdbc", signature(x = "SparkDataFrame", url = "character", tableName = "character"), function(x, url, tableName, mode = "error", ...){ @@ -2926,7 +3015,7 @@ setMethod("write.jdbc", #' # df_list contains 3 SparkDataFrames with each having about 200, 300 and 500 rows respectively #' sapply(df_list, count) #' } -#' @note since 2.0.0 +#' @note randomSplit since 2.0.0 setMethod("randomSplit", signature(x = "SparkDataFrame", weights = "numeric"), function(x, weights, seed) { http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/SQLContext.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/SQLContext.R b/R/pkg/R/SQLContext.R index b846b3d..8d2c4ac 100644 --- a/R/pkg/R/SQLContext.R +++ b/R/pkg/R/SQLContext.R @@ -67,6 +67,7 @@ dispatchFunc <- function(newFuncSig, x, ...) { } #' return the SparkSession +#' @note getSparkSession since 2.0.0 getSparkSession <- function() { if (exists(".sparkRsession", envir = .sparkREnv)) { get(".sparkRsession", envir = .sparkREnv) @@ -76,6 +77,7 @@ getSparkSession <- function() { } #' infer the SQL type +#' @note infer_type since 1.4.0 infer_type <- function(x) { if (is.null(x)) { stop("can not infer type from NULL") @@ -133,7 +135,7 @@ getDefaultSqlSource <- function() { #' } #' @name createDataFrame #' @method createDataFrame default - +#' @note createDataFrame since 1.4.0 # TODO(davies): support sampling and infer type from NA createDataFrame.default <- function(data, schema = NULL, samplingRatio = 1.0) { sparkSession <- getSparkSession() @@ -218,7 +220,7 @@ createDataFrame <- function(x, ...) { #' @aliases createDataFrame #' @export #' @method as.DataFrame default - +#' @note as.DataFrame since 1.6.0 as.DataFrame.default <- function(data, schema = NULL, samplingRatio = 1.0) { createDataFrame(data, schema, samplingRatio) } @@ -266,7 +268,7 @@ setMethod("toDF", signature(x = "RDD"), #' } #' @name read.json #' @method read.json default - +#' @note read.json since 1.6.0 read.json.default <- function(path) { sparkSession <- getSparkSession() # Allow the user to have a more flexible definiton of the text file path @@ -284,7 +286,7 @@ read.json <- function(x, ...) { #' @name jsonFile #' @export #' @method jsonFile default - +#' @note jsonFile since 1.4.0 jsonFile.default <- function(path) { .Deprecated("read.json") read.json(path) @@ -355,7 +357,7 @@ read.orc <- function(path) { #' @export #' @name read.parquet #' @method read.parquet default - +#' @note read.parquet since 1.6.0 read.parquet.default <- function(path) { sparkSession <- getSparkSession() # Allow the user to have a more flexible definiton of the Parquet file path @@ -373,7 +375,7 @@ read.parquet <- function(x, ...) { #' @name parquetFile #' @export #' @method parquetFile default - +#' @note parquetFile since 1.4.0 parquetFile.default <- function(...) { .Deprecated("read.parquet") read.parquet(unlist(list(...))) @@ -403,7 +405,7 @@ parquetFile <- function(x, ...) { #' } #' @name read.text #' @method read.text default - +#' @note read.text since 1.6.1 read.text.default <- function(path) { sparkSession <- getSparkSession() # Allow the user to have a more flexible definiton of the text file path @@ -435,7 +437,7 @@ read.text <- function(x, ...) { #' } #' @name sql #' @method sql default - +#' @note sql since 1.4.0 sql.default <- function(sqlQuery) { sparkSession <- getSparkSession() sdf <- callJMethod(sparkSession, "sql", sqlQuery) @@ -464,8 +466,7 @@ sql <- function(x, ...) { #' createOrReplaceTempView(df, "table") #' new_df <- tableToDF("table") #' } -#' @note since 2.0.0 - +#' @note tableToDF since 2.0.0 tableToDF <- function(tableName) { sparkSession <- getSparkSession() sdf <- callJMethod(sparkSession, "table", tableName) @@ -487,7 +488,7 @@ tableToDF <- function(tableName) { #' } #' @name tables #' @method tables default - +#' @note tables since 1.4.0 tables.default <- function(databaseName = NULL) { sparkSession <- getSparkSession() jdf <- callJStatic("org.apache.spark.sql.api.r.SQLUtils", "getTables", sparkSession, databaseName) @@ -513,7 +514,7 @@ tables <- function(x, ...) { #' } #' @name tableNames #' @method tableNames default - +#' @note tableNames since 1.4.0 tableNames.default <- function(databaseName = NULL) { sparkSession <- getSparkSession() callJStatic("org.apache.spark.sql.api.r.SQLUtils", @@ -544,7 +545,7 @@ tableNames <- function(x, ...) { #' } #' @name cacheTable #' @method cacheTable default - +#' @note cacheTable since 1.4.0 cacheTable.default <- function(tableName) { sparkSession <- getSparkSession() catalog <- callJMethod(sparkSession, "catalog") @@ -573,7 +574,7 @@ cacheTable <- function(x, ...) { #' } #' @name uncacheTable #' @method uncacheTable default - +#' @note uncacheTable since 1.4.0 uncacheTable.default <- function(tableName) { sparkSession <- getSparkSession() catalog <- callJMethod(sparkSession, "catalog") @@ -596,7 +597,7 @@ uncacheTable <- function(x, ...) { #' } #' @name clearCache #' @method clearCache default - +#' @note clearCache since 1.4.0 clearCache.default <- function() { sparkSession <- getSparkSession() catalog <- callJMethod(sparkSession, "catalog") @@ -625,7 +626,7 @@ clearCache <- function() { #' } #' @name dropTempTable #' @method dropTempTable default - +#' @note dropTempTable since 1.4.0 dropTempTable.default <- function(tableName) { if (class(tableName) != "character") { stop("tableName must be a string.") @@ -691,7 +692,7 @@ dropTempView <- function(viewName) { #' } #' @name read.df #' @method read.df default - +#' @note read.df since 1.4.0 read.df.default <- function(path = NULL, source = NULL, schema = NULL, ...) { sparkSession <- getSparkSession() options <- varargsToEnv(...) @@ -719,7 +720,7 @@ read.df <- function(x, ...) { #' @rdname read.df #' @name loadDF #' @method loadDF default - +#' @note loadDF since 1.6.0 loadDF.default <- function(path = NULL, source = NULL, schema = NULL, ...) { read.df(path, source, schema, ...) } @@ -750,7 +751,7 @@ loadDF <- function(x, ...) { #' } #' @name createExternalTable #' @method createExternalTable default - +#' @note createExternalTable since 1.4.0 createExternalTable.default <- function(tableName, path = NULL, source = NULL, ...) { sparkSession <- getSparkSession() options <- varargsToEnv(...) @@ -798,8 +799,7 @@ createExternalTable <- function(x, ...) { #' df2 <- read.jdbc(jdbcUrl, "table2", partitionColumn = "index", lowerBound = 0, #' upperBound = 10000, user = "username", password = "password") #' } -#' @note since 2.0.0 - +#' @note read.jdbc since 2.0.0 read.jdbc <- function(url, tableName, partitionColumn = NULL, lowerBound = NULL, upperBound = NULL, numPartitions = 0L, predicates = list(), ...) { http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/WindowSpec.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/WindowSpec.R b/R/pkg/R/WindowSpec.R index d840542..9f3b1e4 100644 --- a/R/pkg/R/WindowSpec.R +++ b/R/pkg/R/WindowSpec.R @@ -29,6 +29,7 @@ NULL #' #' @param sws A Java object reference to the backing Scala WindowSpec #' @export +#' @note WindowSpec since 2.0.0 setClass("WindowSpec", slots = list(sws = "jobj")) @@ -43,6 +44,7 @@ windowSpec <- function(sws) { } #' @rdname show +#' @note show(WindowSpec) since 2.0.0 setMethod("show", "WindowSpec", function(object) { cat("WindowSpec", callJMethod(object@sws, "toString"), "\n") @@ -63,6 +65,7 @@ setMethod("show", "WindowSpec", #' partitionBy(ws, "col1", "col2") #' partitionBy(ws, df$col1, df$col2) #' } +#' @note partitionBy(WindowSpec) since 2.0.0 setMethod("partitionBy", signature(x = "WindowSpec"), function(x, col, ...) { @@ -93,6 +96,7 @@ setMethod("partitionBy", #' orderBy(ws, "col1", "col2") #' orderBy(ws, df$col1, df$col2) #' } +#' @note orderBy(WindowSpec, character) since 2.0.0 setMethod("orderBy", signature(x = "WindowSpec", col = "character"), function(x, col, ...) { @@ -102,6 +106,7 @@ setMethod("orderBy", #' @rdname arrange #' @name orderBy #' @export +#' @note orderBy(WindowSpec, Column) since 2.0.0 setMethod("orderBy", signature(x = "WindowSpec", col = "Column"), function(x, col, ...) { @@ -133,6 +138,7 @@ setMethod("orderBy", #' \dontrun{ #' rowsBetween(ws, 0, 3) #' } +#' @note rowsBetween since 2.0.0 setMethod("rowsBetween", signature(x = "WindowSpec", start = "numeric", end = "numeric"), function(x, start, end) { @@ -163,6 +169,7 @@ setMethod("rowsBetween", #' \dontrun{ #' rangeBetween(ws, 0, 3) #' } +#' @note rangeBetween since 2.0.0 setMethod("rangeBetween", signature(x = "WindowSpec", start = "numeric", end = "numeric"), function(x, start, end) { @@ -182,6 +189,7 @@ setMethod("rangeBetween", #' @name over #' @family colum_func #' @export +#' @note over since 2.0.0 setMethod("over", signature(x = "Column", window = "WindowSpec"), function(x, window) { http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/column.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/column.R b/R/pkg/R/column.R index cc2876e..1af65d5 100644 --- a/R/pkg/R/column.R +++ b/R/pkg/R/column.R @@ -30,6 +30,7 @@ setOldClass("jobj") #' #' @slot jc reference to JVM SparkDataFrame column #' @export +#' @note Column since 1.4.0 setClass("Column", slots = list(jc = "jobj")) @@ -46,6 +47,7 @@ setMethod("column", #' @rdname show #' @name show +#' @note show(Column) since 1.4.0 setMethod("show", "Column", function(object) { cat("Column", callJMethod(object@jc, "toString"), "\n") @@ -127,6 +129,7 @@ createMethods() #' @name alias #' @family colum_func #' @export +#' @note alias since 1.4.0 setMethod("alias", signature(object = "Column"), function(object, data) { @@ -147,6 +150,7 @@ setMethod("alias", #' #' @param start starting position #' @param stop ending position +#' @note substr since 1.4.0 setMethod("substr", signature(x = "Column"), function(x, start, stop) { jc <- callJMethod(x@jc, "substr", as.integer(start - 1), as.integer(stop - start + 1)) @@ -164,6 +168,7 @@ setMethod("substr", signature(x = "Column"), #' #' @param x vector of character string whose “starts” are considered #' @param prefix character vector (often of length one) +#' @note startsWith since 1.4.0 setMethod("startsWith", signature(x = "Column"), function(x, prefix) { jc <- callJMethod(x@jc, "startsWith", as.vector(prefix)) @@ -181,6 +186,7 @@ setMethod("startsWith", signature(x = "Column"), #' #' @param x vector of character string whose “ends” are considered #' @param suffix character vector (often of length one) +#' @note endsWith since 1.4.0 setMethod("endsWith", signature(x = "Column"), function(x, suffix) { jc <- callJMethod(x@jc, "endsWith", as.vector(suffix)) @@ -196,6 +202,7 @@ setMethod("endsWith", signature(x = "Column"), #' @family colum_func #' #' @param bounds lower and upper bounds +#' @note between since 1.5.0 setMethod("between", signature(x = "Column"), function(x, bounds) { if (is.vector(bounds) && length(bounds) == 2) { @@ -216,6 +223,7 @@ setMethod("between", signature(x = "Column"), #' cast(df$age, "string") #' cast(df$name, list(type="array", elementType="byte", containsNull = TRUE)) #' } +#' @note cast since 1.4.0 setMethod("cast", signature(x = "Column"), function(x, dataType) { @@ -242,6 +250,7 @@ setMethod("cast", #' filter(df, "age in (10, 30)") #' where(df, df$age %in% c(10, 30)) #' } +#' @note \%in\% since 1.5.0 setMethod("%in%", signature(x = "Column"), function(x, table) { @@ -258,6 +267,7 @@ setMethod("%in%", #' @name otherwise #' @family colum_func #' @export +#' @note otherwise since 1.5.0 setMethod("otherwise", signature(x = "Column", value = "ANY"), function(x, value) { http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/context.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/context.R b/R/pkg/R/context.R index 968a9d2..42f89c8 100644 --- a/R/pkg/R/context.R +++ b/R/pkg/R/context.R @@ -261,6 +261,7 @@ setCheckpointDir <- function(sc, dirName) { #' sparkR.session() #' doubled <- spark.lapply(1:10, function(x){2 * x}) #'} +#' @note spark.lapply since 2.0.0 spark.lapply <- function(list, func) { if (!exists(".sparkRjsc", envir = .sparkREnv)) { stop("SparkR has not been initialized. Please call sparkR.session()") @@ -283,7 +284,7 @@ spark.lapply <- function(list, func) { #'\dontrun{ #' setLogLevel("ERROR") #'} - +#' @note setLogLevel since 2.0.0 setLogLevel <- function(level) { if (!exists(".sparkRjsc", envir = .sparkREnv)) { stop("SparkR has not been initialized. Please call sparkR.session()") http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/functions.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index c26f963..ce23869 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -33,6 +33,7 @@ NULL #' select(df, lit("x")) #' select(df, lit("2015-01-01")) #'} +#' @note lit since 1.5.0 setMethod("lit", signature("ANY"), function(x) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -50,6 +51,7 @@ setMethod("lit", signature("ANY"), #' @family normal_funcs #' @export #' @examples \dontrun{abs(df$c)} +#' @note abs since 1.5.0 setMethod("abs", signature(x = "Column"), function(x) { @@ -67,6 +69,7 @@ setMethod("abs", #' @family math_funcs #' @export #' @examples \dontrun{acos(df$c)} +#' @note acos since 1.5.0 setMethod("acos", signature(x = "Column"), function(x) { @@ -83,6 +86,7 @@ setMethod("acos", #' @family agg_funcs #' @export #' @examples \dontrun{approxCountDistinct(df$c)} +#' @note approxCountDistinct(Column) since 1.4.0 setMethod("approxCountDistinct", signature(x = "Column"), function(x) { @@ -100,6 +104,7 @@ setMethod("approxCountDistinct", #' @family string_funcs #' @export #' @examples \dontrun{\dontrun{ascii(df$c)}} +#' @note ascii since 1.5.0 setMethod("ascii", signature(x = "Column"), function(x) { @@ -117,6 +122,7 @@ setMethod("ascii", #' @family math_funcs #' @export #' @examples \dontrun{asin(df$c)} +#' @note asin since 1.5.0 setMethod("asin", signature(x = "Column"), function(x) { @@ -133,6 +139,7 @@ setMethod("asin", #' @family math_funcs #' @export #' @examples \dontrun{atan(df$c)} +#' @note atan since 1.5.0 setMethod("atan", signature(x = "Column"), function(x) { @@ -149,6 +156,7 @@ setMethod("atan", #' @family agg_funcs #' @export #' @examples \dontrun{avg(df$c)} +#' @note avg since 1.4.0 setMethod("avg", signature(x = "Column"), function(x) { @@ -166,6 +174,7 @@ setMethod("avg", #' @family string_funcs #' @export #' @examples \dontrun{base64(df$c)} +#' @note base64 since 1.5.0 setMethod("base64", signature(x = "Column"), function(x) { @@ -183,6 +192,7 @@ setMethod("base64", #' @family math_funcs #' @export #' @examples \dontrun{bin(df$c)} +#' @note bin since 1.5.0 setMethod("bin", signature(x = "Column"), function(x) { @@ -199,6 +209,7 @@ setMethod("bin", #' @family normal_funcs #' @export #' @examples \dontrun{bitwiseNOT(df$c)} +#' @note bitwiseNOT since 1.5.0 setMethod("bitwiseNOT", signature(x = "Column"), function(x) { @@ -215,6 +226,7 @@ setMethod("bitwiseNOT", #' @family math_funcs #' @export #' @examples \dontrun{cbrt(df$c)} +#' @note cbrt since 1.4.0 setMethod("cbrt", signature(x = "Column"), function(x) { @@ -231,6 +243,7 @@ setMethod("cbrt", #' @family math_funcs #' @export #' @examples \dontrun{ceil(df$c)} +#' @note ceil since 1.5.0 setMethod("ceil", signature(x = "Column"), function(x) { @@ -254,6 +267,7 @@ col <- function(x) { #' @family normal_funcs #' @export #' @examples \dontrun{column(df)} +#' @note column since 1.6.0 setMethod("column", signature(x = "character"), function(x) { @@ -268,6 +282,7 @@ setMethod("column", #' @family math_funcs #' @export #' @examples \dontrun{corr(df$c, df$d)} +#' @note corr since 1.6.0 setMethod("corr", signature(x = "Column"), function(x, col2) { stopifnot(class(col2) == "Column") @@ -290,6 +305,7 @@ setMethod("corr", signature(x = "Column"), #' covar_samp(df$c, df$d) #' covar_samp("c", "d") #' } +#' @note cov since 1.6.0 setMethod("cov", signature(x = "characterOrColumn"), function(x, col2) { stopifnot(is(class(col2), "characterOrColumn")) @@ -298,6 +314,7 @@ setMethod("cov", signature(x = "characterOrColumn"), #' @rdname cov #' @name covar_samp +#' @note covar_samp since 2.0.0 setMethod("covar_samp", signature(col1 = "characterOrColumn", col2 = "characterOrColumn"), function(col1, col2) { stopifnot(class(col1) == class(col2)) @@ -322,6 +339,7 @@ setMethod("covar_samp", signature(col1 = "characterOrColumn", col2 = "characterO #' covar_pop(df$c, df$d) #' covar_pop("c", "d") #' } +#' @note covar_pop since 2.0.0 setMethod("covar_pop", signature(col1 = "characterOrColumn", col2 = "characterOrColumn"), function(col1, col2) { stopifnot(class(col1) == class(col2)) @@ -342,6 +360,7 @@ setMethod("covar_pop", signature(col1 = "characterOrColumn", col2 = "characterOr #' @family math_funcs #' @export #' @examples \dontrun{cos(df$c)} +#' @note cos since 1.5.0 setMethod("cos", signature(x = "Column"), function(x) { @@ -358,6 +377,7 @@ setMethod("cos", #' @family math_funcs #' @export #' @examples \dontrun{cosh(df$c)} +#' @note cosh since 1.5.0 setMethod("cosh", signature(x = "Column"), function(x) { @@ -374,6 +394,7 @@ setMethod("cosh", #' @family agg_funcs #' @export #' @examples \dontrun{count(df$c)} +#' @note count since 1.4.0 setMethod("count", signature(x = "Column"), function(x) { @@ -391,6 +412,7 @@ setMethod("count", #' @family misc_funcs #' @export #' @examples \dontrun{crc32(df$c)} +#' @note crc32 since 1.5.0 setMethod("crc32", signature(x = "Column"), function(x) { @@ -407,6 +429,7 @@ setMethod("crc32", #' @family misc_funcs #' @export #' @examples \dontrun{hash(df$c)} +#' @note hash since 2.0.0 setMethod("hash", signature(x = "Column"), function(x, ...) { @@ -427,6 +450,7 @@ setMethod("hash", #' @family datetime_funcs #' @export #' @examples \dontrun{dayofmonth(df$c)} +#' @note dayofmonth since 1.5.0 setMethod("dayofmonth", signature(x = "Column"), function(x) { @@ -443,6 +467,7 @@ setMethod("dayofmonth", #' @family datetime_funcs #' @export #' @examples \dontrun{dayofyear(df$c)} +#' @note dayofyear since 1.5.0 setMethod("dayofyear", signature(x = "Column"), function(x) { @@ -460,6 +485,7 @@ setMethod("dayofyear", #' @family string_funcs #' @export #' @examples \dontrun{decode(df$c, "UTF-8")} +#' @note decode since 1.6.0 setMethod("decode", signature(x = "Column", charset = "character"), function(x, charset) { @@ -477,6 +503,7 @@ setMethod("decode", #' @family string_funcs #' @export #' @examples \dontrun{encode(df$c, "UTF-8")} +#' @note encode since 1.6.0 setMethod("encode", signature(x = "Column", charset = "character"), function(x, charset) { @@ -493,6 +520,7 @@ setMethod("encode", #' @family math_funcs #' @export #' @examples \dontrun{exp(df$c)} +#' @note exp since 1.5.0 setMethod("exp", signature(x = "Column"), function(x) { @@ -509,6 +537,7 @@ setMethod("exp", #' @family math_funcs #' @export #' @examples \dontrun{expm1(df$c)} +#' @note expm1 since 1.5.0 setMethod("expm1", signature(x = "Column"), function(x) { @@ -525,6 +554,7 @@ setMethod("expm1", #' @family math_funcs #' @export #' @examples \dontrun{factorial(df$c)} +#' @note factorial since 1.5.0 setMethod("factorial", signature(x = "Column"), function(x) { @@ -548,6 +578,7 @@ setMethod("factorial", #' first(df$c) #' first(df$c, TRUE) #' } +#' @note first(characterOrColumn) since 1.4.0 setMethod("first", signature(x = "characterOrColumn"), function(x, na.rm = FALSE) { @@ -569,6 +600,7 @@ setMethod("first", #' @family math_funcs #' @export #' @examples \dontrun{floor(df$c)} +#' @note floor since 1.5.0 setMethod("floor", signature(x = "Column"), function(x) { @@ -585,6 +617,7 @@ setMethod("floor", #' @family math_funcs #' @export #' @examples \dontrun{hex(df$c)} +#' @note hex since 1.5.0 setMethod("hex", signature(x = "Column"), function(x) { @@ -601,6 +634,7 @@ setMethod("hex", #' @family datetime_funcs #' @export #' @examples \dontrun{hour(df$c)} +#' @note hour since 1.5.0 setMethod("hour", signature(x = "Column"), function(x) { @@ -620,6 +654,7 @@ setMethod("hour", #' @family string_funcs #' @export #' @examples \dontrun{initcap(df$c)} +#' @note initcap since 1.5.0 setMethod("initcap", signature(x = "Column"), function(x) { @@ -640,6 +675,7 @@ setMethod("initcap", #' is.nan(df$c) #' isnan(df$c) #' } +#' @note is.nan since 2.0.0 setMethod("is.nan", signature(x = "Column"), function(x) { @@ -648,6 +684,7 @@ setMethod("is.nan", #' @rdname is.nan #' @name isnan +#' @note isnan since 2.0.0 setMethod("isnan", signature(x = "Column"), function(x) { @@ -664,6 +701,7 @@ setMethod("isnan", #' @family agg_funcs #' @export #' @examples \dontrun{kurtosis(df$c)} +#' @note kurtosis since 1.6.0 setMethod("kurtosis", signature(x = "Column"), function(x) { @@ -687,6 +725,7 @@ setMethod("kurtosis", #' last(df$c) #' last(df$c, TRUE) #' } +#' @note last since 1.4.0 setMethod("last", signature(x = "characterOrColumn"), function(x, na.rm = FALSE) { @@ -710,6 +749,7 @@ setMethod("last", #' @family datetime_funcs #' @export #' @examples \dontrun{last_day(df$c)} +#' @note last_day since 1.5.0 setMethod("last_day", signature(x = "Column"), function(x) { @@ -726,6 +766,7 @@ setMethod("last_day", #' @family string_funcs #' @export #' @examples \dontrun{length(df$c)} +#' @note length since 1.5.0 setMethod("length", signature(x = "Column"), function(x) { @@ -742,6 +783,7 @@ setMethod("length", #' @family math_funcs #' @export #' @examples \dontrun{log(df$c)} +#' @note log since 1.5.0 setMethod("log", signature(x = "Column"), function(x) { @@ -758,6 +800,7 @@ setMethod("log", #' @family math_funcs #' @export #' @examples \dontrun{log10(df$c)} +#' @note log10 since 1.5.0 setMethod("log10", signature(x = "Column"), function(x) { @@ -774,6 +817,7 @@ setMethod("log10", #' @family math_funcs #' @export #' @examples \dontrun{log1p(df$c)} +#' @note log1p since 1.5.0 setMethod("log1p", signature(x = "Column"), function(x) { @@ -790,6 +834,7 @@ setMethod("log1p", #' @family math_funcs #' @export #' @examples \dontrun{log2(df$c)} +#' @note log2 since 1.5.0 setMethod("log2", signature(x = "Column"), function(x) { @@ -806,6 +851,7 @@ setMethod("log2", #' @family string_funcs #' @export #' @examples \dontrun{lower(df$c)} +#' @note lower since 1.4.0 setMethod("lower", signature(x = "Column"), function(x) { @@ -822,6 +868,7 @@ setMethod("lower", #' @family string_funcs #' @export #' @examples \dontrun{ltrim(df$c)} +#' @note ltrim since 1.5.0 setMethod("ltrim", signature(x = "Column"), function(x) { @@ -838,6 +885,7 @@ setMethod("ltrim", #' @family agg_funcs #' @export #' @examples \dontrun{max(df$c)} +#' @note max since 1.5.0 setMethod("max", signature(x = "Column"), function(x) { @@ -855,6 +903,7 @@ setMethod("max", #' @family misc_funcs #' @export #' @examples \dontrun{md5(df$c)} +#' @note md5 since 1.5.0 setMethod("md5", signature(x = "Column"), function(x) { @@ -872,6 +921,7 @@ setMethod("md5", #' @family agg_funcs #' @export #' @examples \dontrun{mean(df$c)} +#' @note mean since 1.5.0 setMethod("mean", signature(x = "Column"), function(x) { @@ -888,6 +938,7 @@ setMethod("mean", #' @family agg_funcs #' @export #' @examples \dontrun{min(df$c)} +#' @note min since 1.5.0 setMethod("min", signature(x = "Column"), function(x) { @@ -904,6 +955,7 @@ setMethod("min", #' @family datetime_funcs #' @export #' @examples \dontrun{minute(df$c)} +#' @note minute since 1.5.0 setMethod("minute", signature(x = "Column"), function(x) { @@ -947,6 +999,7 @@ setMethod("monotonically_increasing_id", #' @family datetime_funcs #' @export #' @examples \dontrun{month(df$c)} +#' @note month since 1.5.0 setMethod("month", signature(x = "Column"), function(x) { @@ -963,6 +1016,7 @@ setMethod("month", #' @family normal_funcs #' @export #' @examples \dontrun{negate(df$c)} +#' @note negate since 1.5.0 setMethod("negate", signature(x = "Column"), function(x) { @@ -979,6 +1033,7 @@ setMethod("negate", #' @family datetime_funcs #' @export #' @examples \dontrun{quarter(df$c)} +#' @note quarter since 1.5.0 setMethod("quarter", signature(x = "Column"), function(x) { @@ -995,6 +1050,7 @@ setMethod("quarter", #' @family string_funcs #' @export #' @examples \dontrun{reverse(df$c)} +#' @note reverse since 1.5.0 setMethod("reverse", signature(x = "Column"), function(x) { @@ -1012,6 +1068,7 @@ setMethod("reverse", #' @family math_funcs #' @export #' @examples \dontrun{rint(df$c)} +#' @note rint since 1.5.0 setMethod("rint", signature(x = "Column"), function(x) { @@ -1028,6 +1085,7 @@ setMethod("rint", #' @family math_funcs #' @export #' @examples \dontrun{round(df$c)} +#' @note round since 1.5.0 setMethod("round", signature(x = "Column"), function(x) { @@ -1047,6 +1105,7 @@ setMethod("round", #' @family math_funcs #' @export #' @examples \dontrun{bround(df$c, 0)} +#' @note bround since 2.0.0 setMethod("bround", signature(x = "Column"), function(x, scale = 0) { @@ -1064,6 +1123,7 @@ setMethod("bround", #' @family string_funcs #' @export #' @examples \dontrun{rtrim(df$c)} +#' @note rtrim since 1.5.0 setMethod("rtrim", signature(x = "Column"), function(x) { @@ -1086,6 +1146,7 @@ setMethod("rtrim", #'select(df, stddev(df$age)) #'agg(df, sd(df$age)) #'} +#' @note sd since 1.6.0 setMethod("sd", signature(x = "Column"), function(x) { @@ -1102,6 +1163,7 @@ setMethod("sd", #' @family datetime_funcs #' @export #' @examples \dontrun{second(df$c)} +#' @note second since 1.5.0 setMethod("second", signature(x = "Column"), function(x) { @@ -1119,6 +1181,7 @@ setMethod("second", #' @family misc_funcs #' @export #' @examples \dontrun{sha1(df$c)} +#' @note sha1 since 1.5.0 setMethod("sha1", signature(x = "Column"), function(x) { @@ -1135,6 +1198,7 @@ setMethod("sha1", #' @family math_funcs #' @export #' @examples \dontrun{signum(df$c)} +#' @note signum since 1.5.0 setMethod("signum", signature(x = "Column"), function(x) { @@ -1151,6 +1215,7 @@ setMethod("signum", #' @family math_funcs #' @export #' @examples \dontrun{sin(df$c)} +#' @note sin since 1.5.0 setMethod("sin", signature(x = "Column"), function(x) { @@ -1167,6 +1232,7 @@ setMethod("sin", #' @family math_funcs #' @export #' @examples \dontrun{sinh(df$c)} +#' @note sinh since 1.5.0 setMethod("sinh", signature(x = "Column"), function(x) { @@ -1183,6 +1249,7 @@ setMethod("sinh", #' @family agg_funcs #' @export #' @examples \dontrun{skewness(df$c)} +#' @note skewness since 1.6.0 setMethod("skewness", signature(x = "Column"), function(x) { @@ -1199,6 +1266,7 @@ setMethod("skewness", #' @family string_funcs #' @export #' @examples \dontrun{soundex(df$c)} +#' @note soundex since 1.5.0 setMethod("soundex", signature(x = "Column"), function(x) { @@ -1229,6 +1297,7 @@ setMethod("spark_partition_id", #' @rdname sd #' @name stddev +#' @note stddev since 1.6.0 setMethod("stddev", signature(x = "Column"), function(x) { @@ -1246,6 +1315,7 @@ setMethod("stddev", #' @seealso \link{sd}, \link{stddev_samp} #' @export #' @examples \dontrun{stddev_pop(df$c)} +#' @note stddev_pop since 1.6.0 setMethod("stddev_pop", signature(x = "Column"), function(x) { @@ -1263,6 +1333,7 @@ setMethod("stddev_pop", #' @seealso \link{stddev_pop}, \link{sd} #' @export #' @examples \dontrun{stddev_samp(df$c)} +#' @note stddev_samp since 1.6.0 setMethod("stddev_samp", signature(x = "Column"), function(x) { @@ -1283,6 +1354,7 @@ setMethod("stddev_samp", #' struct(df$c, df$d) #' struct("col1", "col2") #' } +#' @note struct since 1.6.0 setMethod("struct", signature(x = "characterOrColumn"), function(x, ...) { @@ -1304,6 +1376,7 @@ setMethod("struct", #' @family math_funcs #' @export #' @examples \dontrun{sqrt(df$c)} +#' @note sqrt since 1.5.0 setMethod("sqrt", signature(x = "Column"), function(x) { @@ -1320,6 +1393,7 @@ setMethod("sqrt", #' @family agg_funcs #' @export #' @examples \dontrun{sum(df$c)} +#' @note sum since 1.5.0 setMethod("sum", signature(x = "Column"), function(x) { @@ -1336,6 +1410,7 @@ setMethod("sum", #' @family agg_funcs #' @export #' @examples \dontrun{sumDistinct(df$c)} +#' @note sumDistinct since 1.4.0 setMethod("sumDistinct", signature(x = "Column"), function(x) { @@ -1352,6 +1427,7 @@ setMethod("sumDistinct", #' @family math_funcs #' @export #' @examples \dontrun{tan(df$c)} +#' @note tan since 1.5.0 setMethod("tan", signature(x = "Column"), function(x) { @@ -1368,6 +1444,7 @@ setMethod("tan", #' @family math_funcs #' @export #' @examples \dontrun{tanh(df$c)} +#' @note tanh since 1.5.0 setMethod("tanh", signature(x = "Column"), function(x) { @@ -1384,6 +1461,7 @@ setMethod("tanh", #' @family math_funcs #' @export #' @examples \dontrun{toDegrees(df$c)} +#' @note toDegrees since 1.4.0 setMethod("toDegrees", signature(x = "Column"), function(x) { @@ -1400,6 +1478,7 @@ setMethod("toDegrees", #' @family math_funcs #' @export #' @examples \dontrun{toRadians(df$c)} +#' @note toRadians since 1.4.0 setMethod("toRadians", signature(x = "Column"), function(x) { @@ -1416,6 +1495,7 @@ setMethod("toRadians", #' @family datetime_funcs #' @export #' @examples \dontrun{to_date(df$c)} +#' @note to_date since 1.5.0 setMethod("to_date", signature(x = "Column"), function(x) { @@ -1432,6 +1512,7 @@ setMethod("to_date", #' @family string_funcs #' @export #' @examples \dontrun{trim(df$c)} +#' @note trim since 1.5.0 setMethod("trim", signature(x = "Column"), function(x) { @@ -1449,6 +1530,7 @@ setMethod("trim", #' @family string_funcs #' @export #' @examples \dontrun{unbase64(df$c)} +#' @note unbase64 since 1.5.0 setMethod("unbase64", signature(x = "Column"), function(x) { @@ -1466,6 +1548,7 @@ setMethod("unbase64", #' @family math_funcs #' @export #' @examples \dontrun{unhex(df$c)} +#' @note unhex since 1.5.0 setMethod("unhex", signature(x = "Column"), function(x) { @@ -1482,6 +1565,7 @@ setMethod("unhex", #' @family string_funcs #' @export #' @examples \dontrun{upper(df$c)} +#' @note upper since 1.4.0 setMethod("upper", signature(x = "Column"), function(x) { @@ -1504,6 +1588,7 @@ setMethod("upper", #'select(df, var_pop(df$age)) #'agg(df, var(df$age)) #'} +#' @note var since 1.6.0 setMethod("var", signature(x = "Column"), function(x) { @@ -1513,6 +1598,7 @@ setMethod("var", #' @rdname var #' @name variance +#' @note variance since 1.6.0 setMethod("variance", signature(x = "Column"), function(x) { @@ -1530,6 +1616,7 @@ setMethod("variance", #' @seealso \link{var}, \link{var_samp} #' @export #' @examples \dontrun{var_pop(df$c)} +#' @note var_pop since 1.5.0 setMethod("var_pop", signature(x = "Column"), function(x) { @@ -1547,6 +1634,7 @@ setMethod("var_pop", #' @seealso \link{var_pop}, \link{var} #' @export #' @examples \dontrun{var_samp(df$c)} +#' @note var_samp since 1.6.0 setMethod("var_samp", signature(x = "Column"), function(x) { @@ -1563,6 +1651,7 @@ setMethod("var_samp", #' @family datetime_funcs #' @export #' @examples \dontrun{weekofyear(df$c)} +#' @note weekofyear since 1.5.0 setMethod("weekofyear", signature(x = "Column"), function(x) { @@ -1579,6 +1668,7 @@ setMethod("weekofyear", #' @family datetime_funcs #' @export #' @examples \dontrun{year(df$c)} +#' @note year since 1.5.0 setMethod("year", signature(x = "Column"), function(x) { @@ -1596,6 +1686,7 @@ setMethod("year", #' @family math_funcs #' @export #' @examples \dontrun{atan2(df$c, x)} +#' @note atan2 since 1.5.0 setMethod("atan2", signature(y = "Column"), function(y, x) { if (class(x) == "Column") { @@ -1614,6 +1705,7 @@ setMethod("atan2", signature(y = "Column"), #' @family datetime_funcs #' @export #' @examples \dontrun{datediff(df$c, x)} +#' @note datediff since 1.5.0 setMethod("datediff", signature(y = "Column"), function(y, x) { if (class(x) == "Column") { @@ -1632,6 +1724,7 @@ setMethod("datediff", signature(y = "Column"), #' @family math_funcs #' @export #' @examples \dontrun{hypot(df$c, x)} +#' @note hypot since 1.4.0 setMethod("hypot", signature(y = "Column"), function(y, x) { if (class(x) == "Column") { @@ -1650,6 +1743,7 @@ setMethod("hypot", signature(y = "Column"), #' @family string_funcs #' @export #' @examples \dontrun{levenshtein(df$c, x)} +#' @note levenshtein since 1.5.0 setMethod("levenshtein", signature(y = "Column"), function(y, x) { if (class(x) == "Column") { @@ -1668,6 +1762,7 @@ setMethod("levenshtein", signature(y = "Column"), #' @family datetime_funcs #' @export #' @examples \dontrun{months_between(df$c, x)} +#' @note months_between since 1.5.0 setMethod("months_between", signature(y = "Column"), function(y, x) { if (class(x) == "Column") { @@ -1687,6 +1782,7 @@ setMethod("months_between", signature(y = "Column"), #' @family normal_funcs #' @export #' @examples \dontrun{nanvl(df$c, x)} +#' @note nanvl since 1.5.0 setMethod("nanvl", signature(y = "Column"), function(y, x) { if (class(x) == "Column") { @@ -1706,6 +1802,7 @@ setMethod("nanvl", signature(y = "Column"), #' @family math_funcs #' @export #' @examples \dontrun{pmod(df$c, x)} +#' @note pmod since 1.5.0 setMethod("pmod", signature(y = "Column"), function(y, x) { if (class(x) == "Column") { @@ -1724,6 +1821,7 @@ setMethod("pmod", signature(y = "Column"), #' @return the approximate number of distinct items in a group. #' @export #' @examples \dontrun{approxCountDistinct(df$c, 0.02)} +#' @note approxCountDistinct(Column, numeric) since 1.4.0 setMethod("approxCountDistinct", signature(x = "Column"), function(x, rsd = 0.05) { @@ -1739,6 +1837,7 @@ setMethod("approxCountDistinct", #' @return the number of distinct items in a group. #' @export #' @examples \dontrun{countDistinct(df$c)} +#' @note countDistinct since 1.4.0 setMethod("countDistinct", signature(x = "Column"), function(x, ...) { @@ -1761,6 +1860,7 @@ setMethod("countDistinct", #' @name concat #' @export #' @examples \dontrun{concat(df$strings, df$strings2)} +#' @note concat since 1.5.0 setMethod("concat", signature(x = "Column"), function(x, ...) { @@ -1782,6 +1882,7 @@ setMethod("concat", #' @name greatest #' @export #' @examples \dontrun{greatest(df$c, df$d)} +#' @note greatest since 1.5.0 setMethod("greatest", signature(x = "Column"), function(x, ...) { @@ -1804,6 +1905,7 @@ setMethod("greatest", #' @name least #' @export #' @examples \dontrun{least(df$c, df$d)} +#' @note least since 1.5.0 setMethod("least", signature(x = "Column"), function(x, ...) { @@ -1824,6 +1926,7 @@ setMethod("least", #' @name ceiling #' @export #' @examples \dontrun{ceiling(df$c)} +#' @note ceiling since 1.5.0 setMethod("ceiling", signature(x = "Column"), function(x) { @@ -1838,6 +1941,7 @@ setMethod("ceiling", #' @name sign #' @export #' @examples \dontrun{sign(df$c)} +#' @note sign since 1.5.0 setMethod("sign", signature(x = "Column"), function(x) { signum(x) @@ -1851,6 +1955,7 @@ setMethod("sign", signature(x = "Column"), #' @name n_distinct #' @export #' @examples \dontrun{n_distinct(df$c)} +#' @note n_distinct since 1.4.0 setMethod("n_distinct", signature(x = "Column"), function(x, ...) { countDistinct(x, ...) @@ -1864,6 +1969,7 @@ setMethod("n_distinct", signature(x = "Column"), #' @name n #' @export #' @examples \dontrun{n(df$c)} +#' @note n since 1.4.0 setMethod("n", signature(x = "Column"), function(x) { count(x) @@ -1885,6 +1991,7 @@ setMethod("n", signature(x = "Column"), #' @name date_format #' @export #' @examples \dontrun{date_format(df$t, 'MM/dd/yyy')} +#' @note date_format since 1.5.0 setMethod("date_format", signature(y = "Column", x = "character"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "date_format", y@jc, x) @@ -1900,6 +2007,7 @@ setMethod("date_format", signature(y = "Column", x = "character"), #' @name from_utc_timestamp #' @export #' @examples \dontrun{from_utc_timestamp(df$t, 'PST')} +#' @note from_utc_timestamp since 1.5.0 setMethod("from_utc_timestamp", signature(y = "Column", x = "character"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "from_utc_timestamp", y@jc, x) @@ -1919,6 +2027,7 @@ setMethod("from_utc_timestamp", signature(y = "Column", x = "character"), #' @name instr #' @export #' @examples \dontrun{instr(df$c, 'b')} +#' @note instr since 1.5.0 setMethod("instr", signature(y = "Column", x = "character"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "instr", y@jc, x) @@ -1945,6 +2054,7 @@ setMethod("instr", signature(y = "Column", x = "character"), #'next_day(df$d, 'Sun') #'next_day(df$d, 'Sunday') #'} +#' @note next_day since 1.5.0 setMethod("next_day", signature(y = "Column", x = "character"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "next_day", y@jc, x) @@ -1960,6 +2070,7 @@ setMethod("next_day", signature(y = "Column", x = "character"), #' @name to_utc_timestamp #' @export #' @examples \dontrun{to_utc_timestamp(df$t, 'PST')} +#' @note to_utc_timestamp since 1.5.0 setMethod("to_utc_timestamp", signature(y = "Column", x = "character"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "to_utc_timestamp", y@jc, x) @@ -1975,6 +2086,7 @@ setMethod("to_utc_timestamp", signature(y = "Column", x = "character"), #' @rdname add_months #' @export #' @examples \dontrun{add_months(df$d, 1)} +#' @note add_months since 1.5.0 setMethod("add_months", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "add_months", y@jc, as.integer(x)) @@ -1990,6 +2102,7 @@ setMethod("add_months", signature(y = "Column", x = "numeric"), #' @name date_add #' @export #' @examples \dontrun{date_add(df$d, 1)} +#' @note date_add since 1.5.0 setMethod("date_add", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "date_add", y@jc, as.integer(x)) @@ -2005,6 +2118,7 @@ setMethod("date_add", signature(y = "Column", x = "numeric"), #' @name date_sub #' @export #' @examples \dontrun{date_sub(df$d, 1)} +#' @note date_sub since 1.5.0 setMethod("date_sub", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "date_sub", y@jc, as.integer(x)) @@ -2026,6 +2140,7 @@ setMethod("date_sub", signature(y = "Column", x = "numeric"), #' @name format_number #' @export #' @examples \dontrun{format_number(df$n, 4)} +#' @note format_number since 1.5.0 setMethod("format_number", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2046,6 +2161,7 @@ setMethod("format_number", signature(y = "Column", x = "numeric"), #' @name sha2 #' @export #' @examples \dontrun{sha2(df$c, 256)} +#' @note sha2 since 1.5.0 setMethod("sha2", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", "sha2", y@jc, as.integer(x)) @@ -2062,6 +2178,7 @@ setMethod("sha2", signature(y = "Column", x = "numeric"), #' @name shiftLeft #' @export #' @examples \dontrun{shiftLeft(df$c, 1)} +#' @note shiftLeft since 1.5.0 setMethod("shiftLeft", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2080,6 +2197,7 @@ setMethod("shiftLeft", signature(y = "Column", x = "numeric"), #' @name shiftRight #' @export #' @examples \dontrun{shiftRight(df$c, 1)} +#' @note shiftRight since 1.5.0 setMethod("shiftRight", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2098,6 +2216,7 @@ setMethod("shiftRight", signature(y = "Column", x = "numeric"), #' @name shiftRightUnsigned #' @export #' @examples \dontrun{shiftRightUnsigned(df$c, 1)} +#' @note shiftRightUnsigned since 1.5.0 setMethod("shiftRightUnsigned", signature(y = "Column", x = "numeric"), function(y, x) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2116,6 +2235,7 @@ setMethod("shiftRightUnsigned", signature(y = "Column", x = "numeric"), #' @name concat_ws #' @export #' @examples \dontrun{concat_ws('-', df$s, df$d)} +#' @note concat_ws since 1.5.0 setMethod("concat_ws", signature(sep = "character", x = "Column"), function(sep, x, ...) { jcols <- lapply(list(x, ...), function(x) { x@jc }) @@ -2132,6 +2252,7 @@ setMethod("concat_ws", signature(sep = "character", x = "Column"), #' @name conv #' @export #' @examples \dontrun{conv(df$n, 2, 16)} +#' @note conv since 1.5.0 setMethod("conv", signature(x = "Column", fromBase = "numeric", toBase = "numeric"), function(x, fromBase, toBase) { fromBase <- as.integer(fromBase) @@ -2152,6 +2273,7 @@ setMethod("conv", signature(x = "Column", fromBase = "numeric", toBase = "numeri #' @name expr #' @export #' @examples \dontrun{expr('length(name)')} +#' @note expr since 1.5.0 setMethod("expr", signature(x = "character"), function(x) { jc <- callJStatic("org.apache.spark.sql.functions", "expr", x) @@ -2167,6 +2289,7 @@ setMethod("expr", signature(x = "character"), #' @name format_string #' @export #' @examples \dontrun{format_string('%d %s', df$a, df$b)} +#' @note format_string since 1.5.0 setMethod("format_string", signature(format = "character", x = "Column"), function(format, x, ...) { jcols <- lapply(list(x, ...), function(arg) { arg@jc }) @@ -2191,6 +2314,7 @@ setMethod("format_string", signature(format = "character", x = "Column"), #'from_unixtime(df$t) #'from_unixtime(df$t, 'yyyy/MM/dd HH') #'} +#' @note from_unixtime since 1.5.0 setMethod("from_unixtime", signature(x = "Column"), function(x, format = "yyyy-MM-dd HH:mm:ss") { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2236,6 +2360,7 @@ setMethod("from_unixtime", signature(x = "Column"), #' # Thirty-second windows every 10 seconds, e.g. 09:00:00-09:00:30, 09:00:10-09:00:40, ... #' window(df$time, "30 seconds", "10 seconds") #'} +#' @note window since 2.0.0 setMethod("window", signature(x = "Column"), function(x, windowDuration, slideDuration = NULL, startTime = NULL) { stopifnot(is.character(windowDuration)) @@ -2273,6 +2398,7 @@ setMethod("window", signature(x = "Column"), #' @name locate #' @export #' @examples \dontrun{locate('b', df$c, 1)} +#' @note locate since 1.5.0 setMethod("locate", signature(substr = "character", str = "Column"), function(substr, str, pos = 1) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2290,6 +2416,7 @@ setMethod("locate", signature(substr = "character", str = "Column"), #' @name lpad #' @export #' @examples \dontrun{lpad(df$c, 6, '#')} +#' @note lpad since 1.5.0 setMethod("lpad", signature(x = "Column", len = "numeric", pad = "character"), function(x, len, pad) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2307,6 +2434,7 @@ setMethod("lpad", signature(x = "Column", len = "numeric", pad = "character"), #' @name rand #' @export #' @examples \dontrun{rand()} +#' @note rand since 1.5.0 setMethod("rand", signature(seed = "missing"), function(seed) { jc <- callJStatic("org.apache.spark.sql.functions", "rand") @@ -2316,6 +2444,7 @@ setMethod("rand", signature(seed = "missing"), #' @rdname rand #' @name rand #' @export +#' @note rand(numeric) since 1.5.0 setMethod("rand", signature(seed = "numeric"), function(seed) { jc <- callJStatic("org.apache.spark.sql.functions", "rand", as.integer(seed)) @@ -2331,6 +2460,7 @@ setMethod("rand", signature(seed = "numeric"), #' @name randn #' @export #' @examples \dontrun{randn()} +#' @note randn since 1.5.0 setMethod("randn", signature(seed = "missing"), function(seed) { jc <- callJStatic("org.apache.spark.sql.functions", "randn") @@ -2340,6 +2470,7 @@ setMethod("randn", signature(seed = "missing"), #' @rdname randn #' @name randn #' @export +#' @note randn(numeric) since 1.5.0 setMethod("randn", signature(seed = "numeric"), function(seed) { jc <- callJStatic("org.apache.spark.sql.functions", "randn", as.integer(seed)) @@ -2355,6 +2486,7 @@ setMethod("randn", signature(seed = "numeric"), #' @name regexp_extract #' @export #' @examples \dontrun{regexp_extract(df$c, '(\d+)-(\d+)', 1)} +#' @note regexp_extract since 1.5.0 setMethod("regexp_extract", signature(x = "Column", pattern = "character", idx = "numeric"), function(x, pattern, idx) { @@ -2373,6 +2505,7 @@ setMethod("regexp_extract", #' @name regexp_replace #' @export #' @examples \dontrun{regexp_replace(df$c, '(\\d+)', '--')} +#' @note regexp_replace since 1.5.0 setMethod("regexp_replace", signature(x = "Column", pattern = "character", replacement = "character"), function(x, pattern, replacement) { @@ -2391,6 +2524,7 @@ setMethod("regexp_replace", #' @name rpad #' @export #' @examples \dontrun{rpad(df$c, 6, '#')} +#' @note rpad since 1.5.0 setMethod("rpad", signature(x = "Column", len = "numeric", pad = "character"), function(x, len, pad) { jc <- callJStatic("org.apache.spark.sql.functions", @@ -2415,6 +2549,7 @@ setMethod("rpad", signature(x = "Column", len = "numeric", pad = "character"), #'substring_index(df$c, '.', 2) #'substring_index(df$c, '.', -1) #'} +#' @note substring_index since 1.5.0 setMethod("substring_index", signature(x = "Column", delim = "character", count = "numeric"), function(x, delim, count) { @@ -2436,6 +2571,7 @@ setMethod("substring_index", #' @name translate #' @export #' @examples \dontrun{translate(df$c, 'rnlt', '123')} +#' @note translate since 1.5.0 setMethod("translate", signature(x = "Column", matchingString = "character", replaceString = "character"), function(x, matchingString, replaceString) { @@ -2458,6 +2594,7 @@ setMethod("translate", #'unix_timestamp(df$t) #'unix_timestamp(df$t, 'yyyy-MM-dd HH') #'} +#' @note unix_timestamp since 1.5.0 setMethod("unix_timestamp", signature(x = "missing", format = "missing"), function(x, format) { jc <- callJStatic("org.apache.spark.sql.functions", "unix_timestamp") @@ -2467,6 +2604,7 @@ setMethod("unix_timestamp", signature(x = "missing", format = "missing"), #' @rdname unix_timestamp #' @name unix_timestamp #' @export +#' @note unix_timestamp(Column) since 1.5.0 setMethod("unix_timestamp", signature(x = "Column", format = "missing"), function(x, format) { jc <- callJStatic("org.apache.spark.sql.functions", "unix_timestamp", x@jc) @@ -2476,6 +2614,7 @@ setMethod("unix_timestamp", signature(x = "Column", format = "missing"), #' @rdname unix_timestamp #' @name unix_timestamp #' @export +#' @note unix_timestamp(Column, character) since 1.5.0 setMethod("unix_timestamp", signature(x = "Column", format = "character"), function(x, format = "yyyy-MM-dd HH:mm:ss") { jc <- callJStatic("org.apache.spark.sql.functions", "unix_timestamp", x@jc, format) @@ -2492,6 +2631,7 @@ setMethod("unix_timestamp", signature(x = "Column", format = "character"), #' @seealso \link{ifelse} #' @export #' @examples \dontrun{when(df$age == 2, df$age + 1)} +#' @note when since 1.5.0 setMethod("when", signature(condition = "Column", value = "ANY"), function(condition, value) { condition <- condition@jc @@ -2514,6 +2654,7 @@ setMethod("when", signature(condition = "Column", value = "ANY"), #' ifelse(df$a > 1 & df$b > 2, 0, 1) #' ifelse(df$a > 1, df$a, 1) #' } +#' @note ifelse since 1.5.0 setMethod("ifelse", signature(test = "Column", yes = "ANY", no = "ANY"), function(test, yes, no) { @@ -2544,6 +2685,7 @@ setMethod("ifelse", #' @family window_funcs #' @export #' @examples \dontrun{cume_dist()} +#' @note cume_dist since 1.6.0 setMethod("cume_dist", signature(x = "missing"), function() { @@ -2566,6 +2708,7 @@ setMethod("cume_dist", #' @family window_funcs #' @export #' @examples \dontrun{dense_rank()} +#' @note dense_rank since 1.6.0 setMethod("dense_rank", signature(x = "missing"), function() { @@ -2586,6 +2729,7 @@ setMethod("dense_rank", #' @family window_funcs #' @export #' @examples \dontrun{lag(df$c)} +#' @note lag since 1.6.0 setMethod("lag", signature(x = "characterOrColumn"), function(x, offset, defaultValue = NULL) { @@ -2613,6 +2757,7 @@ setMethod("lag", #' @family window_funcs #' @export #' @examples \dontrun{lead(df$c)} +#' @note lead since 1.6.0 setMethod("lead", signature(x = "characterOrColumn", offset = "numeric", defaultValue = "ANY"), function(x, offset, defaultValue = NULL) { @@ -2640,6 +2785,7 @@ setMethod("lead", #' @family window_funcs #' @export #' @examples \dontrun{ntile(1)} +#' @note ntile since 1.6.0 setMethod("ntile", signature(x = "numeric"), function(x) { @@ -2662,6 +2808,7 @@ setMethod("ntile", #' @family window_funcs #' @export #' @examples \dontrun{percent_rank()} +#' @note percent_rank since 1.6.0 setMethod("percent_rank", signature(x = "missing"), function() { @@ -2685,6 +2832,7 @@ setMethod("percent_rank", #' @family window_funcs #' @export #' @examples \dontrun{rank()} +#' @note rank since 1.6.0 setMethod("rank", signature(x = "missing"), function() { @@ -2710,6 +2858,7 @@ setMethod("rank", #' @family window_funcs #' @export #' @examples \dontrun{row_number()} +#' @note row_number since 1.6.0 setMethod("row_number", signature(x = "missing"), function() { @@ -2730,6 +2879,7 @@ setMethod("row_number", #' @family collection_funcs #' @export #' @examples \dontrun{array_contains(df$c, 1)} +#' @note array_contains since 1.6.0 setMethod("array_contains", signature(x = "Column", value = "ANY"), function(x, value) { @@ -2746,6 +2896,7 @@ setMethod("array_contains", #' @family collection_funcs #' @export #' @examples \dontrun{explode(df$c)} +#' @note explode since 1.5.0 setMethod("explode", signature(x = "Column"), function(x) { @@ -2762,6 +2913,7 @@ setMethod("explode", #' @family collection_funcs #' @export #' @examples \dontrun{size(df$c)} +#' @note size since 1.5.0 setMethod("size", signature(x = "Column"), function(x) { @@ -2787,6 +2939,7 @@ setMethod("size", #' sort_array(df$c) #' sort_array(df$c, FALSE) #' } +#' @note sort_array since 1.6.0 setMethod("sort_array", signature(x = "Column"), function(x, asc = TRUE) { http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/group.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/group.R b/R/pkg/R/group.R index 65b9e84..51e1516 100644 --- a/R/pkg/R/group.R +++ b/R/pkg/R/group.R @@ -31,6 +31,7 @@ setOldClass("jobj") #' #' @param sgd A Java object reference to the backing Scala GroupedData #' @export +#' @note GroupedData since 1.4.0 setClass("GroupedData", slots = list(sgd = "jobj")) @@ -46,6 +47,7 @@ groupedData <- function(sgd) { #' @rdname show +#' @note show(GroupedData) since 1.4.0 setMethod("show", "GroupedData", function(object) { cat("GroupedData\n") @@ -64,6 +66,7 @@ setMethod("show", "GroupedData", #' \dontrun{ #' count(groupBy(df, "name")) #' } +#' @note count since 1.4.0 setMethod("count", signature(x = "GroupedData"), function(x) { @@ -90,6 +93,7 @@ setMethod("count", #' df3 <- agg(df, ageSum = sum(df$age)) # Creates a new column named ageSum #' df4 <- summarize(df, ageSum = max(df$age)) #' } +#' @note agg since 1.4.0 setMethod("agg", signature(x = "GroupedData"), function(x, ...) { @@ -117,6 +121,7 @@ setMethod("agg", #' @rdname summarize #' @name summarize +#' @note summarize since 1.4.0 setMethod("summarize", signature(x = "GroupedData"), function(x, ...) { @@ -190,6 +195,7 @@ createMethods() #' 3 3 3.0 #' 1 1 1.5 #' } +#' @note gapply(GroupedData) since 2.0.0 setMethod("gapply", signature(x = "GroupedData"), function(x, func, schema) { http://git-wip-us.apache.org/repos/asf/spark/blob/d0eddb80/R/pkg/R/jobj.R ---------------------------------------------------------------------- diff --git a/R/pkg/R/jobj.R b/R/pkg/R/jobj.R index 5b9142b..4905e1f 100644 --- a/R/pkg/R/jobj.R +++ b/R/pkg/R/jobj.R @@ -71,6 +71,7 @@ jobj <- function(objId) { #' #' @param x The JVM object reference #' @param ... further arguments passed to or from other methods +#' @note print.jobj since 1.4.0 print.jobj <- function(x, ...) { name <- getClassName.jobj(x) cat("Java ref type", name, "id", x$id, "\n", sep = " ") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org For additional commands, e-mail: commits-help@spark.apache.org