Hi all.
I have an array named TOM. The command dim(TOM)
returns 2, 4000, 4000.
When I run:
consensusTOM <- pmin(TOM[1, , ], TOM[2, , ])
It returns a matrix containing the parallel minima values between the two input arguments, which is exactly what I need.
I want to write a function that, for whatever value I have for the first margin of this array, would apply pmin()
considering each element as an individual argument to the pmin()
function.
Then, if I input an array of dimensions 3, 4000, 4000, it would do:
consensusTOM <- pmin(TOM[1, , ], TOM[2, , ], TOM[3, , ])
Likewise, if I input an array of dimensions 4, 4000, 4000, it would do:
consensusTOM <- pmin(TOM[1, , ], TOM[2, , ], TOM[3, , ], TOM[4, , ])
And so on and so forth.
Does anyone know how to do this in R?