ianmcook commented on a change in pull request #9875:
URL: https://github.com/apache/arrow/pull/9875#discussion_r606365095



##########
File path: r/R/compute.R
##########
@@ -80,6 +80,36 @@ collect_arrays_from_dots <- function(dots) {
   ChunkedArray$create(!!!arrays)
 }
 
+#' @export
+quantile.ArrowDatum <- function(x,
+                                probs = seq(0, 1, 0.25),
+                                na.rm = FALSE,
+                                interpolation = c("linear", "lower", "higher", 
"nearest", "midpoint"),
+                                ...) {
+  if (inherits(x, "Scalar")) x <- Array$create(x)
+  assert_is(probs, c("numeric", "integer"))
+  assert_that(length(probs) > 0)
+  assert_that(all(probs >= 0 & probs <= 1))
+  if (!na.rm && TRUE %in% as.vector(unique(is.na(x)))) {
+    stop("Missing values not allowed if 'na.rm' is FALSE", call. = FALSE)

Review comment:
       That's what `median` does. This is what `quantile` does when `na.rm = 
FALSE`.
   
   `median` wraps this but handles the `na.rm = FALSE` case separately so this 
`stop()` will never run when `median` is called.




-- 
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]


Reply via email to