Closed MilesMcBain closed 4 years ago
Here's a reprex that highlights the issue:
library(tibble) library(magrittr) library(simputation) tibble::tribble( ~`a col`, ~`b col`, 1, NA, 3, 3, 5, 5, 7, 7 ) %>% as.data.frame() %>% impute_knn(`b col` ~ `a col`, k = 3) #> Error in `[.data.frame`(dat, imp_vars): undefined columns selected tibble::tribble( ~a.col, ~b.col, 1, NA, 3, 3, 5, 5, 7, 7 ) %>% as.data.frame() %>% impute_knn(b.col ~ a.col, k = 3) #> a.col b.col #> 1 1 3 #> 2 3 3 #> 3 5 5 #> 4 7 7
I think the issue is caused by the extraction of formula components in get_imputed and get_predictors . I see 'get_imputed(dat, `b col` ~ `a col`)' returns "`b col`" rather than "b col" which is required to index the column.
get_imputed
get_predictors
That's a bug. Thanks for the report!
Finally fixed this. As a token of gratitude, you have been immortalized in the NEWS file :)
Here's a reprex that highlights the issue:
I think the issue is caused by the extraction of formula components in
get_imputed
andget_predictors
. I see 'get_imputed(dat, `b col` ~ `a col`)' returns "`b col`" rather than "b col" which is required to index the column.