search for: return_cor

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

Did you mean: return_code
2013 Feb 22
2
How to merge two functions into one?
...n = 1440 * 720, signed = T) } resultscor<-apply(file_tot,c(1,2),function(x){cor(x[,1],x[,2],use = "na.or.complete")}) I would like to calculate the correlation only when the `P-value is lower than 0.05`. so this function bellow will do the job: return_cor = function(x, y) { z = cor.test(x,y) if(z[[3]] < 0.05) { return(z[[5]]) } else { return(NA) } } However I got this error(as some pairs of my data are less then 3): Error in cor.test.default(x, y) : not enough finite...