cov {SparkR}R Documentation

cov

Description

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 signature 'characterOrColumn'
cov(x, col2)

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

## S4 method for signature '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

Examples

## Not run: 
##D cov(df$c, df$d)
##D cov("c", "d")
##D covar_samp(df$c, df$d)
##D covar_samp("c", "d")
## End(Not run)
## Not run: 
##D df <- read.json("/path/to/file.json")
##D cov <- cov(df, "title", "gender")
## End(Not run)

[Package SparkR version 2.1.2 Index]