Skip to content

Commit

Permalink
fix: correct solID filtering with redundant name p2
Browse files Browse the repository at this point in the history
  • Loading branch information
laresbernardo committed Jun 3, 2024
1 parent 2230c0d commit 91a2eee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/robyn.R
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ robyn_performance <- function(
if (is.null(end_date)) {
end_date <- as.Date(InputCollect$window_end)
}
df <- df[df$solID == solID, ] %>%
df <- df[df$solID %in% solID, ] %>%
filter(.data$ds >= InputCollect$window_start,
.data$ds <= InputCollect$window_end,
.data$ds >= start_date, .data$ds <= end_date) %>%
Expand Down Expand Up @@ -505,8 +505,9 @@ robyn_performance <- function(
response = sum(response)
)
# Add marketing contribution to sales/conversions (dynamic depending on date)
xDecompPerc <- OutputCollect$xDecompVecCollect %>%
filter(.data$ds >= start_date, .data$ds <= end_date, solID == solID) %>%
xdvc <- OutputCollect$xDecompVecCollect
xDecompPerc <- xdvc[xdvc$solID %in% solID, ] %>%
filter(.data$ds >= start_date, .data$ds <= end_date) %>%
summarise_if(is.numeric, function(x) sum(x, na.rm = TRUE)) %>%
# Divide by prediction, not real values
mutate_all(function(x) x / .$depVarHat) %>%
Expand Down

0 comments on commit 91a2eee

Please sign in to comment.