You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Devesh Raj Singh <ra...@gmail.com> on 2016/01/22 07:23:59 UTC

avg(df$column) not returning a value but just the text "Column avg"

Hi,

I want to create average of numerical columns in iris dataset using sparkR

Sys.setenv('SPARKR_SUBMIT_ARGS'='"--packages"
"com.databricks:spark-csv_2.10:1.3.0" "sparkr-shell"')

library(SparkR)
sc=sparkR.init(master="local",sparkHome =
"/Users/devesh/Downloads/spark-1.4.1-bin-hadoop2.6",sparkPackages =
c("com.databricks:spark-csv_2.10:1.3.0"))
# To read csv files

#initiating the sql context
sqlContext <- sparkRSQL.init(sc)
# example of sparkR
df <- createDataFrame(sqlContext, iris)



*avg(df$Sepal_Length)*

*gives me the output -->*
*Column avg(Sepal_Length)*

*but not a number*
-- 
Warm regards,
Devesh.