Re: [R] truncating a data frame based on a function

2007-09-21 Thread Faheem Mitha
On Fri, 21 Sep 2007, Greg Snow wrote: > Look at the subset function (?subset), it may do what you want. This looks useful. Thanks. However, how can I write an expression selecting certain rows (subset argument) in the case of a matrix? when it does not have named columns? The documentation do

Re: [R] truncating a data frame based on a function

2007-09-21 Thread Greg Snow
eem Mitha > Sent: Friday, September 21, 2007 9:24 AM > To: r-help@r-project.org > Subject: [R] truncating a data frame based on a function > > > Hi, > > Consider the following example. > > > a = c(1,2,3); b = c(4,5,6); c = cbind(a,b); c[(2 < c[,1]) & > (c

[R] truncating a data frame based on a function

2007-09-21 Thread Faheem Mitha
Hi, Consider the following example. > a = c(1,2,3); b = c(4,5,6); c = cbind(a,b); c[(2 < c[,1]) & (c[,1] < 4),] a b 3 6 So, the idea is to select rows for which the value in the first column is between 2 and 4. This works, however, I don't like having to reference a explicitly in this fashio