search for: aorb

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

Did you mean: aor
2012 May 16
2
Help needed for efficient way to loop through rows and columns
...ple": names <- c("S1", "S2", "S3", "S4") X <- c("BB", "AB", "AB", "AA") Y <- c("BB", "BB", "AB", "AA") Z <- c("BB", "BB", "AB", NA) AorB <- c("A", "A", "A", "B") sample <- data.frame(names, X, Y, Z, AorB) for a given row, if AorB == A, then AA == 2, AB = 1, BA = 1, BB = 0 if AorB == B, then AA == 0, AB = 1, BA = 1, BB = 2 I've been trying to write this using apply and ifelse s...