Re: [R] correlation matrix only if enough non-NA values

2012-05-29 Thread Rui Barradas
Hello, Instead of 'sum' use 'mean' ok <- apply(tbl, 2, function(x) mean(!is.na(x)) >= 0.5) cor(tbl[, ok], use="pairwise.complete.obs") Hope this helps, Rui Barradas Em 29-05-2012 10:03, jeff6868 escreveu: Hi everybody. I'm trying to do a correlation matrix in a list of files. Each file cont

[R] correlation matrix only if enough non-NA values

2012-05-29 Thread jeff6868
Hi everybody. I'm trying to do a correlation matrix in a list of files. Each file contains 2 columns: "capt1" and "capt2". For the example, I merged all in one data.frame. My data also contains many missing data. The aim is to do a correlation matrix for the same data for course (one correlation m