Re: [R] How to remove some rows from a data.frame

2007-12-24 Thread affy snp
Hi Henrique, I read in the matrix as x and replicated your code: f <- function(x) { cbind.data.frame(chr=unique(x$chr), Start=min(x$pos), End=max(x$pos), Rows=nrow(x), Pattern=paste("(", x$s1, x$s2, ")") ) } do.call(

Re: [R] How to remove some rows from a data.frame

2007-12-24 Thread Henrique Dallazuanna
My object df is this: df <- structure(list(BAC = structure(c(13L, 3L, 8L, 14L, 12L, 4L, 2L, 5L, 7L, 9L, 11L, 10L, 6L, 1L), .Label = c("CTD-2003M22", "RP11-155C15", "RP11-198H14", "RP11-210E16", "RP11-210F8", "RP11-218N6", "RP11-263L17", "RP11-267M21", "RP11-340F16", "RP11-474G23", "RP11-68A1", "R

Re: [R] How to remove some rows from a data.frame

2007-12-24 Thread affy snp
Dear Henrique, Thanks a lot for the help! I got this: > f <- function(x) + { + cbind.data.frame(chr=unique(x$chr), + Start=min(x$pos), + End=max(x$pos), + Rows=nrow(x), + Pattern=paste("(", x$s1, x$s2, ")") + ) + } >

Re: [R] How to remove some rows from a data.frame

2007-12-24 Thread Henrique Dallazuanna
Try this: f <- function(x) { cbind.data.frame(chr=unique(x$chr), Start=min(x$pos), End=max(x$pos), Rows=nrow(x), Pattern=paste("(", x$s1, x$s2, ")") ) } do.call("rbind", lapply(lapply(split(df, paste(df$s1, df$s2

Re: [R] How to remove some rows from a data.frame

2007-12-24 Thread affy snp
Thanks Moshe! I apologize for not being so clear about the second part. Again, below is how the data looks like. The pattern for columns s1 and s2 will be: (-1 -1) (-1 0) (-1 1) (0 -1) (0 0) (0 1) (1 -1) (1 0) (1 1) 104131 57 631 30566833 15 107 Th

Re: [R] How to remove some rows from a data.frame

2007-12-24 Thread Moshe Olshansky
To answer your firs question try M[-which( M$s1 == 0 & M$s2 == 0),] For the second question, you must start with the more precise definition of the grouping criterion. --- affy snp <[EMAIL PROTECTED]> wrote: > Hello list, > > I have a data frame M like: > > BAC chrpos

Re: [R] How to remove some rows from a data.frame

2007-12-23 Thread Don MacQueen
At 4:28 PM -0500 12/23/07, affy snp wrote: >Hello list, > >I have a data frame M like: > >BAC chrpos s1 s2 >RP11-80G24177465510-10 >RP11-198H14178696291-10 >RP11-267M21179681704-10 >RP11-89A19 180950808-1

Re: [R] How to remove some rows from a data.frame

2007-12-23 Thread Gabor Grothendieck
On Dec 23, 2007 4:28 PM, affy snp <[EMAIL PROTECTED]> wrote: > Hello list, > > I have a data frame M like: > > BAC chrpos s1 s2 > RP11-80G24177465510-10 > RP11-198H14178696291-10 > RP11-267M21179681704-10 > RP11-89A19

[R] How to remove some rows from a data.frame

2007-12-23 Thread affy snp
Hello list, I have a data frame M like: BAC chrpos s1 s2 RP11-80G24177465510-10 RP11-198H14178696291-10 RP11-267M21179681704-10 RP11-89A19 180950808-10 RP11-6B16182255496-10 RP11-21