search for: st3_capt1

Displaying 1 result from an estimated 1 matches for "st3_capt1".

Did you mean: st1_capt1
2012 May 29
1
correlation matrix only if enough non-NA values
...rix, but only with coefficients calculated with at least half of non missing data in the column (in the example, at least 5 non NA values out of 10). table <- data.frame(ST1_capt1=rnorm(1:10),ST1_capt2=c(1,2,3,4,NA,NA,7:9,NA), ST2_capt1=c(NA,NA,NA,NA,NA,6:10),ST2_capt2=c(21,NA,NA,NA,25:30), ST3_capt1=c(1,NA,NA,4:10),ST3_capt2=c(NA,NA,NA,NA,NA,NA,NA,NA,NA,NA)) cormatrix <- cor(table[,c(1,3,5)],use="pairwise.complete.obs") To solve this problem, I think it would be useful to use a code like this before calculating the correlation matrix: if(sum(!is.na(table[1:10,])) >=5) then...