From 43744fb7df8443a5e95065c80d18bd9645eed9da Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Wed, 31 Jul 2024 13:16:04 +0100 Subject: [PATCH] Change made --- instat/static/InstatObject/R/data_object_R6.R | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 8ab9363348a..5444243e367 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -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())