From b9a18cb9e126321aa13fc9004ebefcf3b52b9b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Nov=C3=A1k?= <32874621+Kyoshido@users.noreply.github.com> Date: Thu, 3 Aug 2023 15:48:23 +0200 Subject: [PATCH] Update simCategorical.R I described my problem in issue 22 https://github.com/statistikat/simPop/issues/22 When I was at Statistic Austria I think that we repaired only package party to partykit, we forgot to repair this issue. I got this error > Error in do.call("rbind", probs) : second argument must be a list So this is in simCategorical() specifically in row 67 probs <- predict(mod, newdata=data.table(newdata), type="prob") And the reason for this error is that party package output is list and partykit package output is dataframe. --- R/simCategorical.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/simCategorical.R b/R/simCategorical.R index 42dd054..5fbeb36 100644 --- a/R/simCategorical.R +++ b/R/simCategorical.R @@ -64,6 +64,7 @@ generateValues <- function(dataSample, dataPop, params) { probs <- predict(mod, newdata=newdata, type="probs") }else if ( meth %in% c("ctree","cforest") ) { probs <- predict(mod, newdata=data.table(newdata), type="prob") + probs <- split(probs, seq(nrow(probs))) probs <- do.call("rbind",probs) if(ncol(probs)==2){ probs <- probs[,2]