Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/17783#discussion_r113753986 --- Diff: R/pkg/R/functions.R --- @@ -3803,3 +3803,41 @@ setMethod("repeat_string", jc <- callJStatic("org.apache.spark.sql.functions", "repeat", x@jc, numToInt(n)) column(jc) }) +#' not +#' +#' Inversion of boolean expression. +#' +#' \code{not} and \code{!} cannot be applied directly to numerical column. +#' To achieve R-like truthiness column has to be casted to \code{BooleanType}. +#' +#' @param x Column to compute on +#' @rdname not +#' @name not +#' @aliases not,Column-method +#' @export +#' @examples \dontrun{ +#' df <- createDataFrame(data.frame( +#' is_true = c(TRUE, FALSE, NA), +#' flag = c(1, 0, 1) +#' )) +#' +#' head(select(df, not(df$is_true))) +#' ## (NOT is_true) +#' ##1 FALSE +#' ##2 TRUE +#' ##3 NA +#' +#' # Explicit cast is required when working with numeric column +#' head(select(df, not(cast(df$flag, "boolean")))) +#' ## (NOT CAST(flag AS BOOLEAN)) +#' ## 1 FALSE +#' ## 2 TRUE +#' ## 3 FALSE +#' } +#' @note not since 2.3.0 +setMethod("not", --- End diff -- I think this conflict with testthat..
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org