Skip to content
Prev 274361 / 398506 Next

Remove specific rows in a matrix/data.frame

try this:
+ a 1
+ a 1
+ b 1
+ b 0
+ c 0
+ c 1
+ d 0
+ d 0"), as.is = TRUE, header = TRUE)
+     if (all(.pair$Number[1L] == .pair$Number)) return(.pair[1L, ])
+     is1 <- which(.pair$Number == 1)
+     if (length(is1) == 1) return(.pair[is1, ])
+     else return(NULL)
+ }))
Letter Number
a      a      1
b      b      1
c      c      1
d      d      0

        
On Thu, Oct 13, 2011 at 12:42 PM, syrvn <mentor_ at gmx.net> wrote: