corr
corr.RdComputes the Pearson Correlation Coefficient for two Columns.
Usage
corr(x, ...)
# S4 method for class 'Column'
corr(x, col2)
# S4 method for class 'SparkDataFrame'
corr(x, colName1, colName2, method = "pearson")Arguments
- x
- a Column or a SparkDataFrame. 
- ...
- additional argument(s). If - xis a Column, a Column should be provided. If- xis a SparkDataFrame, two column names should be provided.
- col2
- a (second) Column. 
- colName1
- the name of the first column 
- colName2
- the name of the second column 
- method
- Optional. A character specifying the method for calculating the correlation. only "pearson" is allowed now. 
Examples
if (FALSE) { # \dontrun{
df <- createDataFrame(cbind(model = rownames(mtcars), mtcars))
head(select(df, corr(df$mpg, df$hp)))} # }
if (FALSE) { # \dontrun{
corr(df, "mpg", "hp")
corr(df, "mpg", "hp", method = "pearson")} # }