Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

apply.condition

Apply to each column a method under condition


Description

Apply to each column a method under condition.

Usage

apply.condition(x,method = "+",oper = ">",cond.val = 0)

Arguments

x

An integer matrix.

method

One of: "+", "-", "*", "min", "max".

oper

One of: ">, "<", ">=", "<=".

cond.val

An integer value for the condition.

Details

Apply to each col the specified method using the condition.

Value

An integer vector with the coresponding values.

Author(s)

Manos Papadakis and Michail Tsagris

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com> and Michail Tsagris <mtsagris@yahoo.gr>.

See Also

Examples

x <- matrix(rpois(100,6),10, 10)
identical(apply(x,2,function(x){ sum(x[x>0]) }), apply.condition(x,"+",">",0))
x<-NULL

Rfast

A Collection of Efficient and Extremely Fast R Functions

v2.0.1
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Marios Dimitriadis, Stefanos Fafalios, Ioannis Tsamardinos, Matteo Fasiolo, Giorgos Borboudakis, John Burkardt, Changliang Zou, Kleanthi Lakiotaki and Christina Chatzipantsiou.
Initial release
2020-09-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.