zero323 commented on a change in pull request #29905:
URL: https://github.com/apache/spark/pull/29905#discussion_r498646041
##########
File path: R/pkg/R/functions.R
##########
@@ -3298,6 +3298,42 @@ setMethod("lead",
column(jc)
})
+#' @details
+#' \code{nth_value}: Window function: returns the value that is the
\code{offset}th
+#' row of the window frame# (counting from 1), and \code{null} if the size of
window
+#' frame is less than \code{offset} rows.
+#'
+#' @param offset a numeric indicating number of row to use as the value
+#' @param na.rm a logical which indicates that the Nth value should skip null
in the
+#' determination of which row to use
+#'
+#' @rdname column_window_functions
+#' @aliases nth_value nth_value,characterOrColumn-method
+#' @examples
+#' \dontrun{
+#' nth_value(df$mpg, 3)
+#' nth_value(df$mpg, 3, TRUE)
+#' }
Review comment:
> It seems that we have a different place to put the example. Please see
the following.
>
> * https://spark.apache.org/docs/latest/api/R/column_window_functions.html
We are actually pretty inconsistent about. At the end of the day all
examples for the same `rdname` are placed in the sample example block, so it
doesn't make much difference in practice. The biggest advantage of having
"top-level" `examples` is that we can avoid redefinition of auxiliary objects.
But having examples few KLOCs from actual code is not great. One possible
approach would be to split functions by family. Anyway, just thinking out loud.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]