AVERAGEIF {ExcelFunctionsR} | R Documentation |
Basic AVERAGEIF function from excel
Description
It acts similiarly to Excel's AVERAGEIF function. It calculates the average of the values where certain criterias are met.
Usage
AVERAGEIF(range, criteria, average_range)
Arguments
range |
Give this function argument range for it to evaluate your criteria. |
criteria |
Give this function a criteria so it can check the range for this criteria. |
average_range |
Give this function a range for it to average on. So first it evaluates range argument based on criteria and it averages the numbers that meet the criteria. |
Value
It takes the average of the column data where there are certain conditions met. In the example you can see we are testing if Species equal setosa and wherever this holds true we average the numbers. Example's result show the average of the Petal width of setosa Species. Function will always return numeric class.
Examples
AVERAGEIF(iris$Species,"setosa",iris$Petal.Width)
[Package ExcelFunctionsR version 0.1.4 Index]