x<-c(-3. -4.7, -.005, 1, 9) > length(x[x<0]) [1] 3 Anne
----- Original Message ----- From: "Frederic renaud" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, January 05, 2005 5:07 PM Subject: [R] count element in column > 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)? > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
