[R] comparing vectors with condition

arunkumar1111 akpbond007 at gmail.com
Mon Feb 13 06:38:30 CET 2012


Hi

I have two vector

x=c(10,30,40,50)
total=c(20,20,0,10)

Var_exceeding_total=sum(as.numeric(x> total))

This will compare the vectors x and total a gives the result.

if i want to compare only if the y > 0 .
can we apply condition in the comparison ?
 

-----
Thanks in Advance
        Arun
--
View this message in context: http://r.789695.n4.nabble.com/comparing-vectors-with-condition-tp4382946p4382946.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list