Skip to contents

Returns a new SparkDataFrame with columns dropped. This is a no-op if schema doesn't contain column name(s).

Usage

drop(x, col, ...)

# S4 method for class 'SparkDataFrame,characterOrColumn'
drop(x, col, ...)

# S4 method for class 'ANY,ANY'
drop(x)

Arguments

x

a SparkDataFrame.

col

a list of columns or single Column or name.

...

additional column(s) if only one column is specified in col. If more than one column is assigned in col, ... should be left empty.

Value

A new SparkDataFrame with selected columns.

Note

drop(SparkDataFrame, characterOrColumn, ...) since 3.4.0

Examples

if (FALSE) { # \dontrun{
sparkR.session()
path <- "path/to/file.json"
df <- read.json(path)
drop(df, "col1")
drop(df, c("col1", "col2"))
drop(df, df$col1)
drop(df, "col1", "col2")
drop(df, df$name, df$age)
} # }