varimpact
varimpact copied to clipboard
cannot plot numeric variables
Hi Chris
The plot does not seem to be working for numeric variables. I get:
vim$numeric_vims$results_by_level
NULL
Not sure if there is a more efficient way to do this, but in plot-var.R, if we replace lines 21-30:
# Can only plot numerics currently, need to expand to factors.
numeric_vars = unique(vim$numeric_vims$results_by_level$name)
factor_vars = unique(vim$factor_vims$results_by_level$name)
if (var_name %in% numeric_vars) {
results = vim$numeric_vims$results_by_level
} else if (var_name %in% factor_vars) {
results = vim$factor_vims$results_by_level
} else {
stop("There is no variable called", var_name, ".\n")
}
by
# Can only plot numerics currently, need to expand to factors.
factor_vars = unique(vim$factor_vims$results_by_level$name)
if (var_name %in% vim$numeric_vims$colnames_numeric) {
results = vim$numeric_vims$vim_numeric[[which(vim$numeric_vims$colnames_numeric == var_name)]]$results_by_level
} else if (var_name %in% factor_vars) {
results = vim$factor_vims$results_by_level
} else {
stop("There is no variable called", var_name, ".\n")
}
it works!