search for: vectorizaton

Displaying 2 results from an estimated 2 matches for "vectorizaton".

Did you mean: vectorization
2005 Jul 12
1
vectorizaton
Hi, I got 1000 NxN matrices grouped in one array. I want one matrix in which p_ij is the average of all the 1000 matrices in the array. Here's what I'm trying to do: # P is the NxNx1000 array for(i in 1:N) for(j in 1:N) for(k in 1: 1000) mymat[ i, j ] <- mean( P [i , j , k ] ) Otherwise, I could have a NxNx1000 vector, and get the N^2 means of the 1+ (N^2)*(0: 999) elements. I
2009 Aug 19
2
how do i vectorize relational queries in R
...ta <- data.frame(c(1,1,1,2,2,2,3,3,3),rep(2,9)); names(data) <- > c("Sample","Score") > meta <- data.frame(c(1,2,3),c("Tree","Tree","Shrub")); names(meta) <- > c("Sample","Stratum") The following attempt at vectorizaton doesn't work: > data$Stratum <- meta$Stratum[which(data$Sample == meta$Sample)] > data$Stratum [1] Tree <NA> <NA> Tree <NA> <NA> Tree <NA> <NA> And actually, when I try to run a loop, the operation converts the string to a factor. > for (i i...