cov

0th

Percentile

cov

Compute the sample covariance between two expressions.

Calculate the sample covariance of two numerical columns of a SparkDataFrame.

Usage
cov(x, ...)

covar_samp(col1, col2)

# S4 method for characterOrColumn cov(x, col2)

# S4 method for characterOrColumn,characterOrColumn covar_samp(col1, col2)

# S4 method for SparkDataFrame cov(x, colName1, colName2)

Arguments
x

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.

col1

the first Column.

col2

the second Column.

colName1

the name of the first column

colName2

the name of the second column

Value

The covariance of the two columns.

Note

cov since 1.6.0

covar_samp since 2.0.0

cov since 1.6.0

See Also

Other math_funcs: acos, asin, atan2, atan, bin, bround, cbrt, ceil, conv, corr, cosh, cos, covar_pop, expm1, exp, factorial, floor, hex, hypot, log10, log1p, log2, log, pmod, rint, round, shiftLeft, shiftRightUnsigned, shiftRight, signum, sinh, sin, sqrt, tanh, tan, toDegrees, toRadians, unhex

Other stat functions: approxQuantile, corr, crosstab, freqItems, sampleBy

Aliases
  • cov
  • covar_samp
  • cov
  • cov,characterOrColumn-method
  • covar_samp
  • covar_samp,characterOrColumn,characterOrColumn-method
  • cov
  • cov,SparkDataFrame-method
Examples
# NOT RUN {
cov(df$c, df$d)
cov("c", "d")
covar_samp(df$c, df$d)
covar_samp("c", "d")
# }
# NOT RUN {
df <- read.json("/path/to/file.json")
cov <- cov(df, "title", "gender")
# }
Documentation reproduced from package SparkR, version 2.1.2, License: Apache License (== 2.0)

Community examples

Looks like there are no examples yet.