aggregateData {matman}R Documentation

Performs a temporal aggregation of a data frame

Description

Aggregates a data frame based on a timestamp column to days, weeks, months, quarters, years or total.

Usage

aggregateData(
  data,
  value = NULL,
  item,
  timestamp,
  temporalAggregation = c("day", "week", "month", "quarter", "year", "total"),
  fiscal = 1,
  aggregationFun = sum
)

Arguments

data

Data frame or matrix on which the ABC analysis is performed.

value

Name(s) of the column variable(s) that contains the values for the ABC and XYZ analysis.

item

Names of the columns including the item names or identifiers (e.g., product name, EAN).

timestamp

Name of the column including the timestamp. This column should be in POSIX or Date-format.

temporalAggregation

Temporal aggregation mode for the XYZ-analysis. Possible modes are 'day', 'week', 'month', 'quarter', 'year', and 'total'. Total only aggregates by item whereas the other modes aggregate by item an temporal unit.

fiscal

consider the start of the business year. Default is set to 1 (January)

aggregationFun

Function for aggregating the value column. Default is sum.

Value

Returns a data frame with the aggregated data with the columns of item, timestamp and sum, which is the sum of the value column.

Author(s)

Leon Binder leon.binder@th-deg.de

Bernhard Bauer bernhard.bauer@th-deg.de

Michael Scholz michael.scholz@th-deg.de

See Also

expandData

Examples

data('Amount')
aggregatedData = aggregateData(data = Amount,
    value = "value",
    item = "item",
    timestamp = "date",
    temporalAggregation = "quarter")

[Package matman version 1.1.3 Index]