Thanks for the complete code. For the future, the preferred format is a reproducible example, called a reprex.
The error messages tell the story: X
isn't found because you can't subset a closure
(i.e)., function).
cov[, c("sex", "ability", "grip", "bmic")]
will never work. This is why you should never use reserved names like cov
. Always check by just entering it
cov
before trying to assign an object to it.
cov<-na.omit(v)
If v
had been found, you might have been able to skate by.
The troubles begin, however, with test_impute
. How have you satisfied yourself that it actually is in the namespace?