# mean¶

mean is an aggregate function that returns the average of all values in the specified column.

Syntax:

• mean(df$col) Parameters: • df: Any SparkDataFrame • col: Column in SparkDataFrame Output: • Column Object require(SparkR) # Create SparkDataFrame df <- createDataFrame(mtcars) head(df)  # Calculate average qsec (1/4 mile time) head(select(df, mean(df$qsec)))