You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ggally_cor(), one of the arguments is use, which ostensibly affects how NAs are handled by passing the argument to cor. However, cor is not in fact used for the calculation of the correlation; instead, cor.test is used, which crucially does not have an argument called use.
test_df<-data.frame(a= c(0, 1, 0, 1, 1, NA),
b= c(0, 1, 0, 1, NA, 1),
c= c(0, 1, 0, 1, 0, 0))
# these two are exactly the same...
ggpairs(test_df, upper=list(continuous= wrap(ggally_cor, use="complete.obs")))
ggpairs(test_df, upper=list(continuous= wrap(ggally_cor, use="pairwise.complete.obs")))
# ...even though these two are not
cor(test_df, use="complete.obs")
cor(test_df, use="pairwise.complete.obs")
Two additional notes:
Because of how cor.test is called, the function actually only receives the two vectors for which the correlation is calculated. Hence, use is somewhat superfluous, because the only possible way to handle NAs is to exclude any incomplete observations for those two vectors. cor.test has no information about NAs in other variables, which would be needed in order to exclude observations that have NAs elsewhere (for "complete.obs").
The documentation should also be changed to reflect the use of cor.test instead of cor.
The text was updated successfully, but these errors were encountered:
In
ggally_cor()
, one of the arguments isuse
, which ostensibly affects how NAs are handled by passing the argument tocor
. However,cor
is not in fact used for the calculation of the correlation; instead,cor.test
is used, which crucially does not have an argument calleduse
.https://github.com/ggobi/ggally/blob/3918c50808458dec0c1dfb17fcdc846e9bda80f3/R/gg-plots.R#L354C21-L354C21
Two additional notes:
cor.test
is called, the function actually only receives the two vectors for which the correlation is calculated. Hence,use
is somewhat superfluous, because the only possible way to handle NAs is to exclude any incomplete observations for those two vectors.cor.test
has no information about NAs in other variables, which would be needed in order to exclude observations that have NAs elsewhere (for "complete.obs").cor.test
instead ofcor
.The text was updated successfully, but these errors were encountered: