Hello, I'm trying to impute missing values for both continuous and categorical covariates in cox regression, but i keep on getting this error;` Error in rmultinom(1, size = 1, prob = prob) : NA in probability vector`

. Can somebody help me with this. Thank you.

```
library(survival)
library(reprex)
library(simsurv)
##generating survival data
set.seed(123)
covs <- data.frame(id = 1:10, trt = stats::rbinom(10, 1L, 0.5))
s1 <- simsurv(lambdas = 0.1, gammas = 1.5, betas = c(trt = -0.5),
x = covs, maxt = 5)
###generating missing data
require("mice")
#> Loading required package: mice
#> Loading required package: lattice
#>
#> Attaching package: 'mice'
#> The following objects are masked from 'package:base':
#>
#> cbind, rbind
set.seed(2016)
testdata <- MASS::mvrnorm(n = 10, mu = c(10, 5, 0), Sigma = matrix(data = c(1.0, 0.2, 0.2, 0.2, 1.0, 0.2, 0.2, 0.2, 1.0), nrow = 3, byrow = T))
testdata <- as.data.frame(testdata)
result <- ampute(testdata)
fac<-c("a","a","NA","NA","b","c","NA","b","d","c")
fac<-ifelse(fac=="NA",NA, fac)
fac<-as.factor(fac)
###Combining the data
data<-data.frame(result$amp,s1,fac)
head(data)
#> V1 V2 V3 id eventtime status fac
#> 1 10.309509 6.047666 0.5174884 1 5.0000000 0 a
#> 2 9.110356 4.832951 NA 2 2.9999360 1 a
#> 3 11.016491 4.755048 NA 3 0.9009437 1 <NA>
#> 4 9.136003 NA 0.5045639 4 0.5164432 1 <NA>
#> 5 NA 6.210910 1.4382012 5 5.0000000 0 b
#> 6 10.436947 5.705906 -0.5634077 6 3.9970411 1 c
################
###Multiple imputation
library(smcfcs)
#imputation method
method=as.matrix(rep("",dim(data)[2]))
rownames(method)=names(data)
method[c("fac"),]="mlogit"
method[c("V1","V2","V3"),]="norm"
# impute the data
mi=smcfcs(originaldata=data,smtype="coxph",smformula="Surv(eventtime,status) ~ V1+V2+V3",
method=method,m=10,numit=10)
#> [1] "Outcome variable(s): eventtime,status"
#> [1] "Passive variables: "
#> [1] "Partially obs. variables: V1,V2,V3,fac"
#> [1] "Fully obs. substantive model variables: "
#> [1] "Imputation 1"
#> [1] "Imputing: V1 using V2,V3,fac plus outcome"
#> [1] "Imputing: V2 using V1,V3,fac plus outcome"
#> [1] "Imputing: V3 using V1,V2,fac plus outcome"
#> [1] "Imputing: fac using V1,V2,V3 plus outcome"
#> Error in rmultinom(1, size = 1, prob = prob): NA in probability vector .In addition: There were 50 or more warnings (use warnings() to see the first 50)
```

^{Created on 2019-12-26 by the reprex package (v0.3.0)}