Re: [R] Including a vector element in an if statement

2009-04-19 Thread David Winsemius
On Apr 19, 2009, at 5:58 PM, Enda Hargaden wrote: Hi all, I've searched high and low on this and found nothing of help. I'm using v2.6.2 and trying to write a function that will count how many people from a dataset fall under a poverty line of 50% of the mean income. a9 is my 100-element

Re: [R] Including a vector element in an if statement

2009-04-19 Thread jim holtman
If all you want is a count, then you can construct a logical vector and count the TRUEs: sum(a9 < (mean(a9) / 2)) On Sun, Apr 19, 2009 at 5:58 PM, Enda Hargaden wrote: > Hi all, > > I've searched high and low on this and found nothing of help. I'm using > v2.6.2 and trying to write a function th

[R] Including a vector element in an if statement

2009-04-19 Thread Enda Hargaden
Hi all, I've searched high and low on this and found nothing of help. I'm using v2.6.2 and trying to write a function that will count how many people from a dataset fall under a poverty line of 50% of the mean income. a9 is my 100-element vector of incomes. I want pa9 to be my vector that counts