Skip to content

Commit

Permalink
Merge pull request #9090 from MeSophie/InfillGapsIssue7901
Browse files Browse the repository at this point in the history
Fixed Bug in Fill Date Gaps Dialogue
  • Loading branch information
N-thony authored Aug 1, 2024
2 parents ca752bd + 43744fb commit 8307206
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions instat/static/InstatObject/R/data_object_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -3292,13 +3292,8 @@ DataSheet$set("public","infill_missing_dates", function(date_name, factors, star
col_names_exp[[i]] <- lazyeval::interp(~ var, var = as.name(col_name))
}
all_factors <- self$get_columns_from_data(factors, use_current_filter = FALSE)
factor_combinations <- combn(names(all_factors), 2, simplify = FALSE)
for (combo in factor_combinations) {
factors_check <- all_factors[, combo]
if (nrow(unique(factors_check)) != nrow(unique(all_factors))) {
stop("Two factors are essentially the same variable.")
}
}
first_factor <- self$get_columns_from_data(factors[1], use_current_filter = FALSE)
if(dplyr::n_distinct(interaction(all_factors, drop = TRUE))!= dplyr::n_distinct(first_factor)) stop("The multiple factor variables are not in sync. Should have same number of levels.")
grouped_data <- self$get_data_frame(use_current_filter = FALSE) %>% dplyr::group_by_(.dots = col_names_exp)
date_ranges <- grouped_data %>% dplyr::summarise_(.dots = setNames(list(lazyeval::interp(~ min(var), var = as.name(date_name)), lazyeval::interp(~ max(var), var = as.name(date_name))), c("min_date", "max_date")))
date_lengths <- grouped_data %>% dplyr::summarise(count = n())
Expand Down

0 comments on commit 8307206

Please sign in to comment.