r - applying function to permutated objects -
I have to say, 20 objects I have a function that analyzes the decomposition. I have a pairing analysis on all pairs Want to do Suppose that the function is cor.test instead of writing all 190 pairs
a < - cor.test (1,2); B & L; - cor.test (1,3); C & lt; - cor.test (1,4) ... How can I apply this function to all couples together and in this situation, the relationship between each pair?
(if it is important, then each object is matrix)
>
code> combn , it is not clear how you will correlate between the matrix, but how can you assume that you have vectors here:
## Put your objects in the same list, if you have ## some patterns for your object names I < - list (obj1, obj2, obj3) ## Then get all the permutations and combn your function (seq_len (length (ll)), 2, fun = function (x) {cor.test (ll [[x [1] ], ll [[x [2]]]}}, simplify = false where your objects are:
obj1 = 1: 5 obj2 = 1: 5 obj3 = 1: 5
Comments
Post a Comment