Skip to content

Commit

Permalink
Replace colSums use with SumColumns; DS-3136
Browse files Browse the repository at this point in the history
  • Loading branch information
flipDevTools committed Feb 22, 2021
1 parent 9906430 commit 6970aee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ importFrom(stats,ave)
importFrom(stats,lm)
importFrom(stats,xtabs)
importFrom(verbs,Sum)
importFrom(verbs,SumColumns)
4 changes: 2 additions & 2 deletions R/waterfall.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
#' @param periods A vector of \code{character} indicating the period(s) to plot
#' (relative to the previous period). If NULL, the total, aggregated across all periods, is shown.
#' @importFrom flipFormat FormatAsPercent
#' @importFrom verbs Sum
#' @importFrom verbs Sum SumColumns
#' @export
Waterfall <- function(x, periods = NULL)
{
all.periods <- names(x$Revenue)
if (is.null(periods))
periods <- all.periods[-1]
# Summing up the sales by category
y <- colSums(x$Table[periods, ])
y <- SumColumns(x$Table[periods, ], remove.missing = FALSE)
y <- y[c(1:3, 5:4)] # Reordering categories
# Computing the base.
lookup <- match(periods, all.periods) - 1
Expand Down

0 comments on commit 6970aee

Please sign in to comment.