Displaying 1 result from an estimated 1 matches for "aamin3".
Did you mean:
aamine
2008 Nov 15
0
min of array
...e is some example code:
nr <- 300
nc <- 300
aa <- array(rnorm(nr*nc*6),c(nr,nr,6))
system.time(aamin1 <- apply(aa,c(1,2),min))
system.time({
aamin2 <- matrix(0,nr,nc)
for(i in 1:nr)
for(j in 1:nc)
aamin2[i,j] <- min(aa[i,j,])
})
system.time(aamin3 <-
pmin(aa[,,1],aa[,,2],aa[,,3],aa[,,4],aa[,,5],aa[,,6]))
I have three questions:
1) is there a better way to use apply than the approach I have taken
2) How can I write a function to use pmin on an array as above, but
when I don't know the size of the array? ie
3) My applications are from...