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

## S4 method for signature 'characterOrColumn'
cov(x, col2)

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

cov(x, ...)

covar_samp(col1, col2)

## S4 method for signature 'SparkDataFrame'
cov(x, col1, col2)

Arguments

x

Column to compute on.

col2

Second column to compute cov_samp.

col1

First column to compute cov_samp.

x

A SparkDataFrame

col1

the name of the first column

col2

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, acos,Column-method; asin, asin,Column-method; atan2, atan2,Column-method; atan, atan,Column-method; bin, bin, bin,Column-method; bround, bround, bround,Column-method; cbrt, cbrt, cbrt,Column-method; ceil, ceil, ceil,Column-method, ceiling, ceiling,Column-method; conv, conv, conv,Column,numeric,numeric-method; corr, corr, corr, corr,Column-method, corr,SparkDataFrame-method; cosh, cosh,Column-method; cos, cos,Column-method; covar_pop, covar_pop, covar_pop,characterOrColumn,characterOrColumn-method; expm1, expm1,Column-method; exp, exp,Column-method; factorial, factorial,Column-method; floor, floor,Column-method; hex, hex, hex,Column-method; hypot, hypot, hypot,Column-method; log10, log10,Column-method; log1p, log1p,Column-method; log2, log2,Column-method; log, log,Column-method; pmod, pmod, pmod,Column-method; rint, rint, rint,Column-method; round, round,Column-method; shiftLeft, shiftLeft, shiftLeft,Column,numeric-method; shiftRightUnsigned, shiftRightUnsigned, shiftRightUnsigned,Column,numeric-method; shiftRight, shiftRight, shiftRight,Column,numeric-method; sign, sign,Column-method, signum, signum, signum,Column-method; sinh, sinh,Column-method; sin, sin,Column-method; sqrt, sqrt,Column-method; tanh, tanh,Column-method; tan, tan,Column-method; toDegrees, toDegrees, toDegrees,Column-method; toRadians, toRadians, toRadians,Column-method; unhex, unhex, unhex,Column-method

Other stat functions: approxQuantile, approxQuantile,SparkDataFrame,character,numeric,numeric-method; corr, corr, corr, corr,Column-method, corr,SparkDataFrame-method; crosstab, crosstab,SparkDataFrame,character,character-method; freqItems, freqItems,SparkDataFrame,character-method; sampleBy, sampleBy, sampleBy,SparkDataFrame,character,list,numeric-method

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.0.0 Index]