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