MetricData: 'MetricData'

View source: R/metricdata.R

MetricDataR Documentation

MetricData

Description

Cleans and tidies data for cohort.type in revenue metric calculations.

Usage

MetricData(
  value,
  from,
  to,
  start,
  end,
  id,
  subscription.length,
  by,
  cohort.type,
  cohort.period,
  mergers,
  trim.id
)

Arguments

value

A vector of containing the revenue per transaction.

from

A vector of class POSIXct or POSIXt, recording the date and time each subscription commences.

to

A vector of class POSIXct or POSIXt, recording the date and time each subscription ends

start

The date at which the analysis outputs should commence. By default, the earliest date recorded in from.

end

The date at which the analysis ends, which is used to determine churn. By default, the most recent date recorded in from.

id

A vector of character, unique identifier for subscribers that made the transactions (e.g., email addresses, names, subscriber keys).

subscription.length

The time unit that describes the subscription length: year to view the data by year, quarter, and month. This is assumed to be the billing period when determining if subscribers have churned or not.

by

The unit of time to report on ("day", "month", "quarter", "year").

cohort.type

How cohorts are to be used when performing the analysis by setting.

"None" All customers are cohort.typed in calculations. "New" Customers added in the preceding by. "Calendar" Calender time periods are used. For example, if cohort.period is set to "year" then calendar years are used as cohorts. "Tenure" Tenure based time periods are used. For example, if cohort.period is set to "year", then cohorts are based on the number of years since a customeer first signed up. then calendar years are used as cohorts.

cohort.period

The period of aggregation to be used, with options of "week", "month", "quarter", and "year". This parameter is only used when cohort.type is "Calendar" or "Tenure"

mergers

A data frame with two variables 'id' and 'id.to'. 'id' contains the ids of companies that appeara, based on their data, to have churned, but have in fact merged with the corresponding 'id.to'.

trim.id

The maximum length of the strings to be used showing ID names (used to avoid situations where string names are so long as to make reading of tables impossible. "quarter", and "year".

Value

A data.frame where the rows represent invoice lines and the variables are:

id The unique identifier. value The total fee/price for a subscription. from The commencement date of a subscription. recurring.value The value divided by proportion of the typicaly invoice period that was covered by the invoice. There are some rounding error issues (e.g., leap years, inconsistencies in how people enter data). Additional information is included in attributes


Displayr/flipRevenueMetrics documentation built on June 14, 2025, 6:54 p.m.