From abe9de87004b911977e3f6e1f89230ca5f659e8e Mon Sep 17 00:00:00 2001 From: James Clark Date: Fri, 26 Jan 2024 13:48:42 -0700 Subject: [PATCH] fix check issues --- R/hts_prep_data.R | 14 +++++--------- R/hts_remove_missing_data.R | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/R/hts_prep_data.R b/R/hts_prep_data.R index 98632cd..b60a887 100644 --- a/R/hts_prep_data.R +++ b/R/hts_prep_data.R @@ -103,7 +103,7 @@ hts_prep_data = function(summarize_var = NULL, summarize_var = summarize_var, summarize_by = summarize_by, ids = id_cols, - missing_value = missing_values, + missing_values = missing_values, not_imputable = not_imputable) } @@ -123,14 +123,6 @@ hts_prep_data = function(summarize_var = NULL, summarize_var = variables_dt[shared_name == summarize_var, variable] - - } - - # only keep ids that are in var_dt - id_cols = intersect(id_cols, names(var_dt)) - - - for(i in 1:length(summarize_var)){ if(var_dt[,class(get(summarize_var[i]))] != 'integer'){ @@ -143,7 +135,11 @@ hts_prep_data = function(summarize_var = NULL, } + + } + # only keep ids that are in var_dt + id_cols = intersect(id_cols, names(var_dt)) # Subset table to these column(s): wtname = wt_cols[tbl_idx] diff --git a/R/hts_remove_missing_data.R b/R/hts_remove_missing_data.R index 755d4f3..351ae9b 100644 --- a/R/hts_remove_missing_data.R +++ b/R/hts_remove_missing_data.R @@ -51,7 +51,7 @@ hts_remove_missing_data = function(hts_data, # get id with the most unique counts to filter on max_index = which.max( - sapply(summarize_var_tbl[, ..ids_in_table], function(x) length(unique(x))) + sapply(summarize_var_tbl[, ids_in_table, with = FALSE], function(x) length(unique(x))) ) summarize_var_id = ids_in_table[max_index] @@ -84,7 +84,7 @@ hts_remove_missing_data = function(hts_data, ids_in_table = intersect(ids, names(summarize_by_tbl)) max_index = which.max( - sapply(summarize_by_tbl[, ..ids_in_table], function(x) length(unique(x))) + sapply(summarize_by_tbl[, ids_in_table, with = FALSE], function(x) length(unique(x))) ) summarize_by_id = ids_in_table[max_index]