columnsΒΆ

columns returns all column names in a SparkDataFrame as a list.

Syntax:

  • columns(df)

Parameters:

  • df: Any SparkDataFrame

Output:

  • List
require(SparkR)

# Create SparkDataFrame
df <- createDataFrame(mtcars)
head(df)
# View all column names in df
columns(df)