search for: rowdiff

Displaying 3 results from an estimated 3 matches for "rowdiff".

2011 Jul 13
1
UNIX diff function
Colleagues, (R: 2.13.0; OS X) I often receive sequential datasets in which there are new rows interposed between existing rows. For example: SET1 <- data.frame(list(LETTERS=LETTERS[c(1:4, 6:10)], NUMBERS=c(1:4, 6:10))) SET2 <- data.frame(list(LETTERS=LETTERS[1:10], NUMBERS=1:10)) > SET1 LETTERS NUMBERS 1 A 1 2 B 2 3 C 3 4 D 4 5
2000 Mar 29
2
regularly lattice & neighbors
Dear R-users, Is there a procedure to identify neighbors in a regular lattice using either a "rook" or a "queen" criterium? To be more specific, suppose: My lattice: 1 2 3 4 5 6 7 8 9 "Rook" Neighbors 1 has neighbors 2,4 2 has neighbors 1,3,5 ... 5 has neighbors 2,4,6,8 "Queen Neighbors" 1 has neighbors 2,4,5 2 has neighbors 1,3,4,5,6 For each case,
2013 Mar 13
1
calculating column difference in a matrix
Dear R users; Consider the following toy example: a <- matrix(c(2,3,4,NA,NA,5,8,NA,8,NA), 5, 2) b <- cbind(a,apply(a, 1, diff, na.rm = TRUE)) What I would like be able to get is: c <- matrix(c(2,3,4,NA,NA,5,8,NA,8,NA,3,5,-4,8,NA), 5, 3) i.e., for each row if both values (column 1 and 2) are NA then the difference must return NA, but if any of those two values is different from NA