ncolΒΆ

ncol returns the number of columns in a SparkDataFrame

Syntax:

  • ncol(df)

Parameters:

  • df: Any SparkDataFrame

Output:

  • List
require(SparkR)

# Create SparkDataFrame
df <- createDataFrame(mtcars)
head(df)
# View number of columns in df
ncol(df)