Apply to each column a method under condition
Apply to each column a method under condition.
apply.condition(x,method = "+",oper = ">",cond.val = 0)
x |
An integer matrix. |
method |
One of: "+", "-", "*", "min", "max". |
oper |
One of: ">, "<", ">=", "<=". |
cond.val |
An integer value for the condition. |
Apply to each col the specified method using the condition.
An integer vector with the coresponding values.
Manos Papadakis and Michail Tsagris
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com> and Michail Tsagris <mtsagris@yahoo.gr>.
x <- matrix(rpois(100,6),10, 10) identical(apply(x,2,function(x){ sum(x[x>0]) }), apply.condition(x,"+",">",0)) x<-NULL
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.