Skip to content

Commit

Permalink
Fix bug so prior day doesn't get deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
akgold committed Jan 3, 2020
1 parent 8958615 commit 1c92172
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bikeHelpR
Type: Package
Title: Package of Helper Functions for the Bike Prediction Asset
Version: 0.2.2
Version: 0.2.3
Authors@R: person("Alex", "Gold", email = "[email protected]",
role = c("aut", "cre"))
Description: Helpful functions for bike prediction.
Expand Down
15 changes: 10 additions & 5 deletions pkg/R/helper_funcs.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,18 @@ bike_mod_results <- function(mod, mod_name, test_df, pred_mat_func) {

print("Writing Goodness of Fit Pin.")
# Create OOS Goodness of Fit and pin
dplyr::bind_cols(tibble::tibble(
train_date = mod_params$train_date,
mod = mod_name),
oos_metrics(test_df$n_bikes, pred_df$preds),
time = Sys.time()) %>%
curr_time <- Sys.time()
dplyr::bind_cols(
tibble::tibble(
train_date = mod_params$train_date,
mod = mod_name,
time = curr_time
),
oos_metrics(test_df$n_bikes, pred_df$preds)
) %>%
# Bind in old
dplyr::bind_rows(pins::pin_get("bike_err", board = "rsconnect")) %>%
dplyr::mutate(time = ifelse(is.na(time), curr_time - 1, time)) %>%
# If re-running today, keep only new
dplyr::group_by(train_date, mod) %>%
dplyr::filter(time == max(time, na.rm = TRUE)) %>%
Expand Down

0 comments on commit 1c92172

Please sign in to comment.