search for: onespositions

Displaying 1 result from an estimated 1 matches for "onespositions".

2008 Jul 18
0
spreading the risk
...nmat) <- NULL rownames(tempbinmat) <- NULL # FIND OUT WHERE ALL THE ONES ARE. # ARR.IND = TRUE GIVES THEM BACK IN MATRIX FORM whichres <- which(tempbinmat == 1, arr.ind=TRUE) # THIS LAPPLY GOES THROUGH THE LOCATIONS WHERE # THERE ARE ONES AND FINDS LOCATIONS WHERE # ONES NEED TO BE ADDED onespositions <- lapply(1:nrow(whichres),function(.rownum) { rightspot <- c(whichres[.rownum,1], whichres[.rownum,2]+1) leftspot <- c(whichres[.rownum,1], whichres[.rownum,2]-1) belowspot <-c(whichres[.rownum,1]-1, whichres[.rownum,2]) abovespot <- c(whichres[.rownum,1]+1, whichres[.ro...