batchy1
subdir <- "SiteCopy/AATNC/results"; cAlc = 16; cPull = 23; # 17, 23; cWS2 = 24; cRT = 20; cAcc = 21; cTrTy = 27; fns <- dir(subdir); icols <- grep("save_AATNC_", fns); AATNC <- numeric(0); for (n in 1:length(icols)) { fn <- paste("SiteCopy/AATNC/results/", fns[icols[n]], sep = ""); print(fn); M <- read.table(fn); for (iAlc in 0:1) { for (iPull in 0:1) { for (iWS2 in 0:1) { dumrow <- matrix(NA, 1, ncol(M)) dumrow[1, cAlc] = iAlc dumrow[1, cPull] = iPull dumrow[1, cWS2] = iWS2 M <- rbind(M, dumrow) } } } #a <- aggregate(M[, cRT], list(M[, cAlc], M[, cPull], M[, cWS2]), length); # for trial counting purposes a <- aggregate(M[, cRT], list(M[, cAlc], M[, cPull], M[, cWS2]), function(x){mean(x, na.rm = TRUE)}); a <- as.matrix(a$x, 1, length(a$x)); tt <- M[1, cTrTy]; newrow <- c(tt, a); newrow <- matrix(newrow, 1, length(newrow)); AATNC <- rbind(AATNC, newrow); } lapply(unique(AATNC[,1]), function(tmp) {colMeans(AATNC[AATNC[,1] == tmp,])});