Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/10201#discussion_r47327943 --- Diff: R/pkg/R/DataFrame.R --- @@ -2223,3 +2215,46 @@ setMethod("with", newEnv <- assignNewEnv(data) eval(substitute(expr), envir = newEnv, enclos = newEnv) }) + +#' drop +#' +#' Returns a new DataFrame with columns dropped. +#' This is a no-op if schema doesn't contain column name(s). +#' +#' @param x A SparkSQL DataFrame. +#' @param cols A character vector of column names or a Column. +#' @return A DataFrame +#' +#' @family DataFrame functions +#' @rdname drop +#' @name drop +#' @export +#' @examples +#'\dontrun{ +#' sc <- sparkR.init() +#' sqlCtx <- sparkRSQL.init(sc) +#' path <- "path/to/file.json" +#' df <- jsonFile(sqlCtx, path) +#' drop(df, "col1") +#' drop(df, c("col1", "col2")) +#' drop(df, df$col1) +#' } +setMethod("drop", + signature(x = "DataFrame"), + function(x, col) { + stopifnot(class(col) == "character" || class(col) == "Column") + + if (class(col) == "character") { --- End diff -- I'd flip this check, since `@jc` should only be called on `Column` but minor point since it's checked in line 2245.
--- 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