Remove NAs from Correlation matrix.


I am working on a data for which i want to correlogram plots. And i am using corrgram package for that. I have two data frames which i want to plot. So for That i am using merge function to combine both frames and then cor function for correlation matrix. I am having too many NA values and i tried different ways to remove it but not able to do so. Please guide with the same.

I have attached picture how matrix looks.


Hi @krnl90,

difficult to help you without any code that you are using. The cor function has a parameter use which you can set to "complete.obs" or "pairwise.complete.obs" - maybe that can work for you.


This is what i used. Also after running this it shows a following warning message:
In cor(MERGED, method = "pearson", use = "complete.obs") :
the standard deviation is zero

Corelation <-cor(MERGED, method = "pearson",use = "complete.obs")

Hope that helps.

"The standard deviation is zero" sounds like you have at least one variable that is constant (that is the same value across the whole column). If a variable has no variation it cannot have co-variation and hence correlation. Non-random quantities do not (co)vary.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.