addCumSums | R Documentation |
Function to add cumulative sums (standard and normalized) of a column to a dataframe by an index column and set of factor columns.
addCumSums(dfr, valCol, idxCol = NULL, factors = NULL, verbose = FALSE)
dfr |
|
valCol |
|
idxCol |
|
factors |
|
verbose |
|
Uses sqldf.
a dataframe of results with columns corresponding to the factors, the index column (if defined), the values column, a "nrmlzd" column, a "cumSum" column, and a "nrmSum" column. The latter three represent the normalized values (summing to 1), the cumulative sum of the values, and the cumulative sum of the normalized values, where the normalization and sums are taken over each factor combination and the associated index set.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.