RevenueData: 'RevenueData'

View source: R/revenuedata.R

RevenueDataR Documentation

RevenueData

Description

Cleans and tidies data for use in growth accounting computations for a startup. Turns all dates with 29th of Feb into the 28th.

Usage

RevenueData(
  value,
  from,
  to,
  start = min(from),
  end = max(from),
  id,
  subscription.length = "year",
  subset = rep(TRUE, length(id)),
  profiling = NULL,
  trim.id = 50
)

Arguments

value

A vector of containing the revenue per transaction.

from

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

to

A vector of class POSIXct or POSIXlt, 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.

subset

An optional vector specifying a subset of observations to be used in the calculations

profiling

A data.frame containing data, unique by id, to be included in the final data.frame. Either it must contain the unique identifiers in a variable called id, or, the rownames must match the values of id.

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.

Value

A data.frame where the rows represent unique combinations of periods and subscribers. Where a subscriber has multiple transactions in a period, they are aggregated. Contains the following variables, along with any other variables in the data: idThe unique identifier. valueThe total fee/price for a subscription. fromThe commencement date of a subscription. from.period The period of the subscription commencement as a character. period.counter The number of the period, where 0 indicates the initial period. toThe end-date of a subscription. to.period The period of the subscription end as a character. subscriber.from The date of a customer's first subscription's commencement. subscriber.from.period The period of subscriber.from. subscriber.to The final date of their most recent subscription. subscriber.to.period The period of subscriber.to. last.from The from date of the most recent subscription. last.from.period The period of last.from. churned A logical indicating if the subscriber had ceased subscribing prior to end. churn A logical indicating if the subscriber had ceased subscribing in that period. tenure The number of whole periods from the begining of the first subscription to the end of the most recent. observation The invoice number for a particular customer, starting from 1. observation.within.period The number of the subscription for a particular customer, starting from 1 for each new subscription period (as determined by a common to.period). 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, inconsistncies in how people enter data).


NumbersInternational/flipStartup documentation built on Feb. 26, 2024, 5:39 a.m.