Closed krzysiektr closed 4 years ago
Thanks @krzysiektr for pointing it out to me!
I take note of suggestions 1 and 3 for personal use, and I have included suggestion 2 in this article.
how does it handle missing values?
Dear @ayokem,
Not sure which function you are referring to, but if you are referring to the cor()
function:
By default, if there are some missing values, the output will be NA
. See for instance:
x <- c(0.6, 0, NA, 0.5)
y <- c(0.4, 0.7, 0.3, 0.2)
cor(x, y)
Unless you use the use = "complete.obs"
argument:
x <- c(0.6, 0, NA, 0.5)
y <- c(0.4, 0.7, 0.3, 0.2)
cor(x, y, use = "complete.obs")
which will give the Pearson correlation coefficient with only the complete pairs.
Hope this helps.
If you have any other questions, I suggest you ask them in the comments of the related post, so everyone can benefit from the discussion.
Regards, Antoine