Closed Chris1221 closed 8 years ago
# -------------- OLD WAY -------------------
combR <- gen2r(genfile = comb, local = TRUE)
b <- phen()
combR <- as.data.frame(foreach(i = 1:nrow(combR), .combine = 'rbind') %:%
foreach(j = 1:ncol(combR), .combine = 'c') %do% {
combR[i,j] <- combR[i,j]*b[j] - b[j]*snps[j,"all_maf"] })
WAS <- rowSums(combR)
# ---------------------------------------------------------
This is way too long, maybe create a vector with three entries for each es and simply multiply the matrices. This has to be faster. Have to make sure that 0*x = 0 and that the 0s don't contribute to rowsums. they shouldn't but just make sure.