calcShare: Share Calculation for Single Key Found in Column

Description Usage Arguments Details

Description

This function is used repeatedly in the query calcultions above. It calculates shares of a total value, where the total value is calculated using an aggregation by Units, scenario, forcing, branch, year, region.

Usage

1
calcShare(key, column, df)

Arguments

key

string, single key found in unique(df$column)

column

unquoted column name, name of column that contains set of all possible keys

df

data.frame, contains "Land Allocation" data from Comparison Figures object

Details

The output contains shares of the total for only one key. To get the shares calculated for all keys, we would grab the set of unique keys, lapply over them, and unlist:

sharesForAllKeys <- lapply(keys, calcshare, column, df) bind_rows()


xavier-gutierrez/validation_figures documentation built on May 24, 2019, 9:58 p.m.