The first line calculates the correlation of each trait with the egienvalue of each module, the second line gives you the p-value of said correlations for a given number of p-values. I advise you to use a function named somehow like corAndPvalue which gives both correlations and p-values takeing into account the number of samples with information for each trait

What code do you use for "the third step"? Are there any NA in your input data? Did you use the "complete" observations option to calculate the correlations?

Yes, I am using complete observations to calculate correlations. There are no NA's in the input dataset for these commands. you can check input files from my question.

Hi Lluis,

Thanks for the reply but the result is still same. I suspect for some reason correlation is not calculating or calculating it to 0 for all the values

What code do you use for "the third step"? Are there any NA in your input data? Did you use the "complete" observations option to calculate the correlations?

I am using this code for third step - https://labs.genetics.ucla.edu/horvath/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-03-relateModsToExt.pdf

Yes, I am using complete observations to calculate correlations. There are no NA's in the input dataset for these commands. you can check input files from my question.