-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi,
I’m getting the following error, and I wonder if you could help me understand its cause:
library(dplyr)
library(simputation)
kdata <- tribble(
~age, ~ct, ~pfratio, ~bmi,
56, 86, 130, 30,
58, NA, 110, NA,
78, NA, NA, 28,
54, NA, NA, NA,
45, 45, 230, 28,
54, 45, NA, 29
)
impute_knn(
kdata,
bmi ~ .,
pool = "univariate"
)
#> Warning: Requested k = 5 while 4 donors present. Using k = 4.
#> Error: Subscript `ina` is a matrix, the data `donors[ina]` must have size 1.Created on 2021-05-30 by the reprex package (v2.0.0)
The same happens if I had more variables to the formula’s left-hand side (e.g., bmi + ct + pfratio ~ .).
I understand the warning that appears in this reprex. However, my actual data is in the hundreds of observations, yet it does have its fair share of NAs, and occasionally there can be up to 3 NAs per row. Is the error related to NAs in predictor variables?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels