AVERAGEIF: Basic AVERAGEIF function from excel

Description Usage Arguments Value Examples

View source: R/AVERAGEIF.R

Description

It acts similiarly to Excel's AVERAGEIF function. It calculates the average of the values where certain criterias are met.

Usage

1
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

1
AVERAGEIF(iris$Species,"setosa",iris$Petal.Width)

ExcelFunctionsR documentation built on July 1, 2020, 8:35 p.m.