columns

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

Syntax:

  • columns(df)

Parameters:

  • df: Any SparkR DataFrame

Output:

  • List
# Create SparkR DataFrame
df <- createDataFrame(sqlContext, mtcars)
head(df)
# View all column names in df
columns(df)