|
@@ -994,14 +994,14 @@ filter_data <- function(df, variables, nf = FALSE, missing = FALSE, adjust = FAL
|
|
|
if (rank) {
|
|
|
if (verbose) message("Calculating ranks for variable(s): ", paste(variables, collapse = ", "))
|
|
|
|
|
|
- for (col in avg_zscore_cols) {
|
|
|
- rank_col <- paste0("Rank_", col)
|
|
|
- df[[rank_col]] <- rank(df[[col]], na.last = "keep")
|
|
|
- }
|
|
|
-
|
|
|
- for (col in z_lm_cols) {
|
|
|
- rank_lm_col <- paste0("Rank_lm_", col)
|
|
|
- df[[rank_lm_col]] <- rank(df[[col]], na.last = "keep")
|
|
|
+ for (variable in variables) {
|
|
|
+ avg_zscore_col <- paste0("Avg_Zscore_", variable)
|
|
|
+ rank_col <- paste0("Rank_", variable)
|
|
|
+ df[[rank_col]] <- rank(df[[avg_zscore_col]], na.last = "keep")
|
|
|
+
|
|
|
+ z_lm_col <- paste0("Z_lm_", variable)
|
|
|
+ rank_lm_col <- paste0("Rank_lm_", variable)
|
|
|
+ df[[rank_lm_col]] <- rank(df[[z_lm_col]], na.last = "keep")
|
|
|
}
|
|
|
}
|
|
|
|