sum(ifelse(x*total!=0, as.numeric(x> total), 0))
arunkumar wrote
>
> 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 t
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
--
V
2 matches
Mail list logo