Skip to content

Commit 11a11f0

Browse files
felixcheungshivaram
authored andcommitted
[SPARK-11756][SPARKR] Fix use of aliases - SparkR can not output help information for SparkR:::summary correctly
Fix use of aliases and changes uses of rdname and seealso `aliases` is the hint for `?` - it should not be linked to some other name - those should be seealso https://cran.r-project.org/web/packages/roxygen2/vignettes/rd.html Clean up usage on family, as multiple use of family with the same rdname is causing duplicated See Also html blocks (like http://spark.apache.org/docs/latest/api/R/count.html) Also changing some rdname for dplyr-like variant for better R user visibility in R doc, eg. rbind, summary, mutate, summarize shivaram yanboliang Author: felixcheung <felixcheung_m@hotmail.com> Closes apache#9750 from felixcheung/rdocaliases. (cherry picked from commit a6239d5) Signed-off-by: Shivaram Venkataraman <shivaram@cs.berkeley.edu>
1 parent b9b0e17 commit 11a11f0

File tree

4 files changed

+37
-84
lines changed

4 files changed

+37
-84
lines changed

R/pkg/R/DataFrame.R

Lines changed: 24 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ setMethod("dtypes",
254254
#' @family DataFrame functions
255255
#' @rdname columns
256256
#' @name columns
257-
#' @aliases names
258257
#' @export
259258
#' @examples
260259
#'\dontrun{
@@ -272,7 +271,6 @@ setMethod("columns",
272271
})
273272
})
274273

275-
#' @family DataFrame functions
276274
#' @rdname columns
277275
#' @name names
278276
setMethod("names",
@@ -281,7 +279,6 @@ setMethod("names",
281279
columns(x)
282280
})
283281

284-
#' @family DataFrame functions
285282
#' @rdname columns
286283
#' @name names<-
287284
setMethod("names<-",
@@ -533,14 +530,8 @@ setMethod("distinct",
533530
dataFrame(sdf)
534531
})
535532

536-
#' @title Distinct rows in a DataFrame
537-
#
538-
#' @description Returns a new DataFrame containing distinct rows in this DataFrame
539-
#'
540-
#' @family DataFrame functions
541-
#' @rdname unique
533+
#' @rdname distinct
542534
#' @name unique
543-
#' @aliases distinct
544535
setMethod("unique",
545536
signature(x = "DataFrame"),
546537
function(x) {
@@ -557,7 +548,7 @@ setMethod("unique",
557548
#'
558549
#' @family DataFrame functions
559550
#' @rdname sample
560-
#' @aliases sample_frac
551+
#' @name sample
561552
#' @export
562553
#' @examples
563554
#'\dontrun{
@@ -579,7 +570,6 @@ setMethod("sample",
579570
dataFrame(sdf)
580571
})
581572

582-
#' @family DataFrame functions
583573
#' @rdname sample
584574
#' @name sample_frac
585575
setMethod("sample_frac",
@@ -589,16 +579,15 @@ setMethod("sample_frac",
589579
sample(x, withReplacement, fraction)
590580
})
591581

592-
#' Count
582+
#' nrow
593583
#'
594584
#' Returns the number of rows in a DataFrame
595585
#'
596586
#' @param x A SparkSQL DataFrame
597587
#'
598588
#' @family DataFrame functions
599-
#' @rdname count
589+
#' @rdname nrow
600590
#' @name count
601-
#' @aliases nrow
602591
#' @export
603592
#' @examples
604593
#'\dontrun{
@@ -614,14 +603,8 @@ setMethod("count",
614603
callJMethod(x@sdf, "count")
615604
})
616605

617-
#' @title Number of rows for a DataFrame
618-
#' @description Returns number of rows in a DataFrames
619-
#'
620606
#' @name nrow
621-
#'
622-
#' @family DataFrame functions
623607
#' @rdname nrow
624-
#' @aliases count
625608
setMethod("nrow",
626609
signature(x = "DataFrame"),
627610
function(x) {
@@ -870,7 +853,6 @@ setMethod("toRDD",
870853
#' @param x a DataFrame
871854
#' @return a GroupedData
872855
#' @seealso GroupedData
873-
#' @aliases group_by
874856
#' @family DataFrame functions
875857
#' @rdname groupBy
876858
#' @name groupBy
@@ -896,7 +878,6 @@ setMethod("groupBy",
896878
groupedData(sgd)
897879
})
898880

899-
#' @family DataFrame functions
900881
#' @rdname groupBy
901882
#' @name group_by
902883
setMethod("group_by",
@@ -913,15 +894,13 @@ setMethod("group_by",
913894
#' @family DataFrame functions
914895
#' @rdname agg
915896
#' @name agg
916-
#' @aliases summarize
917897
#' @export
918898
setMethod("agg",
919899
signature(x = "DataFrame"),
920900
function(x, ...) {
921901
agg(groupBy(x), ...)
922902
})
923903

924-
#' @family DataFrame functions
925904
#' @rdname agg
926905
#' @name summarize
927906
setMethod("summarize",
@@ -1092,7 +1071,6 @@ setMethod("[", signature(x = "DataFrame", i = "Column"),
10921071
#' @family DataFrame functions
10931072
#' @rdname subset
10941073
#' @name subset
1095-
#' @aliases [
10961074
#' @family subsetting functions
10971075
#' @examples
10981076
#' \dontrun{
@@ -1216,7 +1194,7 @@ setMethod("selectExpr",
12161194
#' @family DataFrame functions
12171195
#' @rdname withColumn
12181196
#' @name withColumn
1219-
#' @aliases mutate transform
1197+
#' @seealso \link{rename} \link{mutate}
12201198
#' @export
12211199
#' @examples
12221200
#'\dontrun{
@@ -1231,7 +1209,6 @@ setMethod("withColumn",
12311209
function(x, colName, col) {
12321210
select(x, x$"*", alias(col, colName))
12331211
})
1234-
12351212
#' Mutate
12361213
#'
12371214
#' Return a new DataFrame with the specified columns added.
@@ -1240,9 +1217,9 @@ setMethod("withColumn",
12401217
#' @param col a named argument of the form name = col
12411218
#' @return A new DataFrame with the new columns added.
12421219
#' @family DataFrame functions
1243-
#' @rdname withColumn
1220+
#' @rdname mutate
12441221
#' @name mutate
1245-
#' @aliases withColumn transform
1222+
#' @seealso \link{rename} \link{withColumn}
12461223
#' @export
12471224
#' @examples
12481225
#'\dontrun{
@@ -1273,17 +1250,15 @@ setMethod("mutate",
12731250
})
12741251

12751252
#' @export
1276-
#' @family DataFrame functions
1277-
#' @rdname withColumn
1253+
#' @rdname mutate
12781254
#' @name transform
1279-
#' @aliases withColumn mutate
12801255
setMethod("transform",
12811256
signature(`_data` = "DataFrame"),
12821257
function(`_data`, ...) {
12831258
mutate(`_data`, ...)
12841259
})
12851260

1286-
#' WithColumnRenamed
1261+
#' rename
12871262
#'
12881263
#' Rename an existing column in a DataFrame.
12891264
#'
@@ -1292,8 +1267,9 @@ setMethod("transform",
12921267
#' @param newCol The new column name.
12931268
#' @return A DataFrame with the column name changed.
12941269
#' @family DataFrame functions
1295-
#' @rdname withColumnRenamed
1270+
#' @rdname rename
12961271
#' @name withColumnRenamed
1272+
#' @seealso \link{mutate}
12971273
#' @export
12981274
#' @examples
12991275
#'\dontrun{
@@ -1316,17 +1292,9 @@ setMethod("withColumnRenamed",
13161292
select(x, cols)
13171293
})
13181294

1319-
#' Rename
1320-
#'
1321-
#' Rename an existing column in a DataFrame.
1322-
#'
1323-
#' @param x A DataFrame
1324-
#' @param newCol A named pair of the form new_column_name = existing_column
1325-
#' @return A DataFrame with the column name changed.
1326-
#' @family DataFrame functions
1327-
#' @rdname withColumnRenamed
1295+
#' @param newColPair A named pair of the form new_column_name = existing_column
1296+
#' @rdname rename
13281297
#' @name rename
1329-
#' @aliases withColumnRenamed
13301298
#' @export
13311299
#' @examples
13321300
#'\dontrun{
@@ -1371,7 +1339,6 @@ setClassUnion("characterOrColumn", c("character", "Column"))
13711339
#' @family DataFrame functions
13721340
#' @rdname arrange
13731341
#' @name arrange
1374-
#' @aliases orderby
13751342
#' @export
13761343
#' @examples
13771344
#'\dontrun{
@@ -1395,8 +1362,8 @@ setMethod("arrange",
13951362
dataFrame(sdf)
13961363
})
13971364

1398-
#' @family DataFrame functions
13991365
#' @rdname arrange
1366+
#' @name arrange
14001367
#' @export
14011368
setMethod("arrange",
14021369
signature(x = "DataFrame", col = "character"),
@@ -1427,9 +1394,9 @@ setMethod("arrange",
14271394
do.call("arrange", c(x, jcols))
14281395
})
14291396

1430-
#' @family DataFrame functions
14311397
#' @rdname arrange
1432-
#' @name orderby
1398+
#' @name orderBy
1399+
#' @export
14331400
setMethod("orderBy",
14341401
signature(x = "DataFrame", col = "characterOrColumn"),
14351402
function(x, col) {
@@ -1492,6 +1459,7 @@ setMethod("where",
14921459
#' @family DataFrame functions
14931460
#' @rdname join
14941461
#' @name join
1462+
#' @seealso \link{merge}
14951463
#' @export
14961464
#' @examples
14971465
#'\dontrun{
@@ -1528,9 +1496,7 @@ setMethod("join",
15281496
dataFrame(sdf)
15291497
})
15301498

1531-
#'
15321499
#' @name merge
1533-
#' @aliases join
15341500
#' @title Merges two data frames
15351501
#' @param x the first data frame to be joined
15361502
#' @param y the second data frame to be joined
@@ -1550,6 +1516,7 @@ setMethod("join",
15501516
#' outer join will be returned.
15511517
#' @family DataFrame functions
15521518
#' @rdname merge
1519+
#' @seealso \link{join}
15531520
#' @export
15541521
#' @examples
15551522
#'\dontrun{
@@ -1671,7 +1638,7 @@ generateAliasesForIntersectedCols <- function (x, intersectedColNames, suffix) {
16711638
cols
16721639
}
16731640

1674-
#' UnionAll
1641+
#' rbind
16751642
#'
16761643
#' Return a new DataFrame containing the union of rows in this DataFrame
16771644
#' and another DataFrame. This is equivalent to `UNION ALL` in SQL.
@@ -1681,7 +1648,7 @@ generateAliasesForIntersectedCols <- function (x, intersectedColNames, suffix) {
16811648
#' @param y A Spark DataFrame
16821649
#' @return A DataFrame containing the result of the union.
16831650
#' @family DataFrame functions
1684-
#' @rdname unionAll
1651+
#' @rdname rbind
16851652
#' @name unionAll
16861653
#' @export
16871654
#' @examples
@@ -1700,13 +1667,11 @@ setMethod("unionAll",
17001667
})
17011668

17021669
#' @title Union two or more DataFrames
1703-
#'
17041670
#' @description Returns a new DataFrame containing rows of all parameters.
17051671
#'
1706-
#' @family DataFrame functions
17071672
#' @rdname rbind
17081673
#' @name rbind
1709-
#' @aliases unionAll
1674+
#' @export
17101675
setMethod("rbind",
17111676
signature(... = "DataFrame"),
17121677
function(x, ..., deparse.level = 1) {
@@ -1795,7 +1760,6 @@ setMethod("except",
17951760
#' @family DataFrame functions
17961761
#' @rdname write.df
17971762
#' @name write.df
1798-
#' @aliases saveDF
17991763
#' @export
18001764
#' @examples
18011765
#'\dontrun{
@@ -1828,7 +1792,6 @@ setMethod("write.df",
18281792
callJMethod(df@sdf, "save", source, jmode, options)
18291793
})
18301794

1831-
#' @family DataFrame functions
18321795
#' @rdname write.df
18331796
#' @name saveDF
18341797
#' @export
@@ -1891,7 +1854,7 @@ setMethod("saveAsTable",
18911854
callJMethod(df@sdf, "saveAsTable", tableName, source, jmode, options)
18921855
})
18931856

1894-
#' describe
1857+
#' summary
18951858
#'
18961859
#' Computes statistics for numeric columns.
18971860
#' If no columns are given, this function computes statistics for all numerical columns.
@@ -1901,9 +1864,8 @@ setMethod("saveAsTable",
19011864
#' @param ... Additional expressions
19021865
#' @return A DataFrame
19031866
#' @family DataFrame functions
1904-
#' @rdname describe
1867+
#' @rdname summary
19051868
#' @name describe
1906-
#' @aliases summary
19071869
#' @export
19081870
#' @examples
19091871
#'\dontrun{
@@ -1923,8 +1885,7 @@ setMethod("describe",
19231885
dataFrame(sdf)
19241886
})
19251887

1926-
#' @family DataFrame functions
1927-
#' @rdname describe
1888+
#' @rdname summary
19281889
#' @name describe
19291890
setMethod("describe",
19301891
signature(x = "DataFrame"),
@@ -1934,11 +1895,6 @@ setMethod("describe",
19341895
dataFrame(sdf)
19351896
})
19361897

1937-
#' @title Summary
1938-
#'
1939-
#' @description Computes statistics for numeric columns of the DataFrame
1940-
#'
1941-
#' @family DataFrame functions
19421898
#' @rdname summary
19431899
#' @name summary
19441900
setMethod("summary",
@@ -1966,7 +1922,6 @@ setMethod("summary",
19661922
#' @family DataFrame functions
19671923
#' @rdname nafunctions
19681924
#' @name dropna
1969-
#' @aliases na.omit
19701925
#' @export
19711926
#' @examples
19721927
#'\dontrun{
@@ -1993,7 +1948,6 @@ setMethod("dropna",
19931948
dataFrame(sdf)
19941949
})
19951950

1996-
#' @family DataFrame functions
19971951
#' @rdname nafunctions
19981952
#' @name na.omit
19991953
#' @export
@@ -2019,9 +1973,7 @@ setMethod("na.omit",
20191973
#' type are ignored. For example, if value is a character, and
20201974
#' subset contains a non-character column, then the non-character
20211975
#' column is simply ignored.
2022-
#' @return A DataFrame
20231976
#'
2024-
#' @family DataFrame functions
20251977
#' @rdname nafunctions
20261978
#' @name fillna
20271979
#' @export

R/pkg/R/broadcast.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Broadcast <- function(id, value, jBroadcastRef, objName) {
5151
#
5252
# @param bcast The broadcast variable to get
5353
# @rdname broadcast
54-
# @aliases value,Broadcast-method
5554
setMethod("value",
5655
signature(bcast = "Broadcast"),
5756
function(bcast) {

0 commit comments

Comments
 (0)