Computes the Pearson Correlation Coefficient for two Columns.
Usagecorr(x, ...)
# S4 method for class 'Column'
corr(x, col2)
# S4 method for class 'SparkDataFrame'
corr(x, colName1, colName2, method = "pearson")
Arguments
a Column or a SparkDataFrame.
additional argument(s). If x
is a Column, a Column should be provided. If x
is a SparkDataFrame, two column names should be provided.
a (second) Column.
the name of the first column
the name of the second column
Optional. A character specifying the method for calculating the correlation. only "pearson" is allowed now.
The Pearson Correlation Coefficient as a Double.
Notecorr since 1.6.0
corr since 1.6.0
Examplesif (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")} # }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4