Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/11267#discussion_r53573356
--- Diff: R/pkg/R/functions.R ---
@@ -536,15 +536,27 @@ setMethod("factorial",
#'
#' Aggregate function: returns the first value in a group.
#'
+#' The function by default returns the first values it sees. It will
return the first non-NA
+#' value it sees when ignoreNAs is set to true. If all values are NA, then
NA is returned.
+#'
#' @rdname first
#' @name first
#' @family agg_funcs
#' @export
-#' @examples \dontrun{first(df$c)}
+#' @examples
+#' \dontrun{
+#' first(df$c)
+#' first(df$c, TRUE)
+#' }
setMethod("first",
- signature(x = "Column"),
- function(x) {
- jc <- callJStatic("org.apache.spark.sql.functions", "first",
x@jc)
+ signature(x = "characterOrColumn"),
+ function(x, ignoreNAs = FALSE) {
--- End diff --
probably something like `na.rm=TRUE` would be more R like
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]