Skip to content

Commit

Permalink
fix check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
james-clark-rsg committed Jan 26, 2024
1 parent 58e7b9a commit abe9de8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 5 additions & 9 deletions R/hts_prep_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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'){
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions R/hts_remove_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit abe9de8

Please sign in to comment.