[R] select rows by criteria

2012-03-01 Thread syrvn
Hello, I am stuck with selecting the right rows from a data frame. I think the problem is rather how to select them then how to implement the R code. Consider the following data frame: df - data.frame(ID = c(1,2,3,4,5,6,7,8,9,10), value = c(34,12,23,25,34,42,48,29,30,27)) What I want to

Re: [R] select rows by criteria

2012-03-01 Thread Petr Savicky
On Thu, Mar 01, 2012 at 04:27:45AM -0800, syrvn wrote: Hello, I am stuck with selecting the right rows from a data frame. I think the problem is rather how to select them then how to implement the R code. Consider the following data frame: df - data.frame(ID = c(1,2,3,4,5,6,7,8,9,10),

Re: [R] select rows by criteria

2012-03-01 Thread Petr Savicky
On Thu, Mar 01, 2012 at 05:42:48PM +0100, Petr Savicky wrote: On Thu, Mar 01, 2012 at 04:27:45AM -0800, syrvn wrote: Hello, I am stuck with selecting the right rows from a data frame. I think the problem is rather how to select them then how to implement the R code. Consider the

Re: [R] select rows by criteria

2012-03-01 Thread Rui Barradas
Hello, syrvn wrote Hello, I am stuck with selecting the right rows from a data frame. I think the problem is rather how to select them then how to implement the R code. Consider the following data frame: df - data.frame(ID = c(1,2,3,4,5,6,7,8,9,10), value =

Re: [R] select rows by criteria

2012-03-01 Thread Rui Barradas
Sorry, correction: The second index matrix is the matrix of elements not in the first, not another combination, this time 3 out of 10. Change this in my first post inxmat - with(DF, combn(ID, 3)) meansDist2 - apply(inxmat, 2, function(jnx) f(jnx, DF$value, 45)) (i2 - which(meansDist2 ==

Re: [R] select rows by criteria

2012-03-01 Thread Petr Savicky
On Thu, Mar 01, 2012 at 05:42:48PM +0100, Petr Savicky wrote: On Thu, Mar 01, 2012 at 04:27:45AM -0800, syrvn wrote: Hello, I am stuck with selecting the right rows from a data frame. I think the problem is rather how to select them then how to implement the R code. Consider the

Re: [R] select rows by criteria

2012-03-01 Thread Rui Barradas
Hello, again. Petr Savicky wrote On Thu, Mar 01, 2012 at 05:42:48PM +0100, Petr Savicky wrote: On Thu, Mar 01, 2012 at 04:27:45AM -0800, syrvn wrote: Hello, I am stuck with selecting the right rows from a data frame. I think the problem is rather how to select them then how to