Hi,<br><br>I have written small code in C++ using Armadillo and inline with RcppArmadillo package. <br>The input is data.marix(X). Some cells might be NAs. Example in R: X = matrix(sample(c(rnorm(10*9.9),NA)),ncol=10)<br><br>
I am calculating conditional correlation on columns of that matrix, just picking vectors, so cor(X,Y).<br>The problem is that sometimes I might have empty cell in one or both vectors, in that case I would like to skip that row, and procede with calculating Pearson's correlation on remaining data. I know that there will be difference in degrees of freedom, but I have over 100 rows, so skiping few shouldnt matter that much.<br>
<br>Basically my question boils down to solving the problem:<br>How to find which colvec cells are nan, and remove this index from both X and Y colvec, before calculating correlation.<br><br>I would be very grateful for help,<br>
<br>Kind regards,<br>Mateusz Kaduk<br>