calc_percent_growth: Calculates percentage growth on an absolute or per period...

Description Usage Arguments Value

View source: R/calc_percent_growth.R

Description

Allows the calculation of percentage change in a variable over user-defined periods of time, on either an absolute basis, or averaged over the course of the period.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
calc_percent_growth(
  data,
  period_col,
  start_period,
  end_period,
  periods,
  value_col,
  calculation,
  ...
)

Arguments

data

Dataframe holding the data you would like to perform the calculation for.

period_col

The column containing data for the period the value you are calculating pertains to.

start_period

The first period you want to use for your calculations. Must be present in the period_col.

end_period

The last period you want to use for your calculations. Must be present in the period_col.

periods

Number of periods covered in the calculation. First period is period 0.

value_col

The column containing the value you want to calculate percentage growth for.

calculation

Specify whether you would like to calculate growth on an absolute or average per period basis.

...

Grouping variables if the data needs to be aggregated.

Value

A dataframe containing the calculated percentages for the specified grouping variables and periods considered. It will be listed for the start period to the end period.


shanej90/commoncalcs documentation built on Oct. 21, 2020, 8:43 a.m.