[R] count element in column
Robert Kruus
bob at kruus.forestry.utoronto.ca
Wed Jan 5 19:11:27 CET 2005
How about
sum(res<0)?
--
robert.kruus at utoronto.ca
The computer should be doing the hard work. That's what it's paid to
do, after all.
-- Larry Wall in <199709012312.QAA08121 at wall.org>
--------
It is rumored that on Wed, 5 Jan 2005 08:07:34 -0800 (PST)
Frederic renaud <fren2 at yahoo.com> wrote:
> Hi,
> I 've a matrix n*1 (thus a column) and I would like to
> count the number of negative element inside.
> Can you help me?
> Thanks!
>
> eg:
> res[,1]= 1
> -3
> -1
>
> How obtain the number 2 (number of negative-element)?
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
--------
--
robert.kruus at utoronto.ca
A beginning is the time for taking the most delicate care that balances
are correct.
-- Princess Irulan, "Manual of Maud'Dib"
More information about the R-help
mailing list