-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-12903] [SparkR] Add covar_samp and covar_pop for SparkR #10829
Conversation
Jenkins, test this please. |
Test build #49680 has finished for PR 10829 at commit
|
@@ -424,6 +424,14 @@ setGeneric("cov", function(x, col1, col2) {standardGeneric("cov") }) | |||
#' @export | |||
setGeneric("corr", function(x, ...) {standardGeneric("corr") }) | |||
|
|||
#' @rdname statfunctions | |||
#' @export | |||
setGeneric("covar_samp", function(x, ...) {standardGeneric("covar_samp") }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number of parameters are fixed to be 2. No need to support varargs.
Something like:
setGeneric("covar_samp", function(col1, col2) {standardGeneric("covar_samp") })
@yanboliang, please add a new method for "cov", which is alias to "covar_samp" |
Test build #49898 has finished for PR 10829 at commit
|
@sun-rui Thanks for your comments. There is a setMethod("cov",
signature(x = "DataFrame", col1 = "character", col2 = "character"),
function(x, col1, col2) {
statFunctions <- callJMethod(x@sdf, "stat")
callJMethod(statFunctions, "cov", col1, col2)
}) And this |
Test build #49900 has finished for PR 10829 at commit
|
@yanboliang, we can have different methods for a generic function. You can try something like follows:
|
Test build #49913 has finished for PR 10829 at commit
|
Test build #49954 has finished for PR 10829 at commit
|
LGTM |
looks good |
LGTM. Thanks @yanboliang - Merging this to master |
Add
covar_samp
andcovar_pop
for SparkR.Should we also provide
cov
alias forcovar_samp
? There iscov
implementation at stats.R which masksstats::cov
already, but may bring to breaking API change.cc @sun-rui @felixcheung @shivaram