Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 0, 58430

cces18D$Classification <- recode(cces18D$Classification, "1=0; 2=1")

cces18D$Classification <- as.factor(cces18D$Classification)

prediction.frame <- expand.grid(CC18_325d = levels(cces18D$CC18_325d))

predictions <- predict.glm(m1, 
                          CC18_325d = prediction.frame, type = "response",se.fit = T)

predictions <- as.tibble(cbind(prediction.frame, predictions))  

predictions <- mutate(predictions,
                      lwr = fit - 1.96*se.fit,
                      upr = fit + 1.96*se.fit)



Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 0, 58430

6. stop(gettextf("arguments imply differing number of rows: %s", paste(unique(nrows), collapse = ", ")), domain = NA)

5. data.frame(..., check.names = FALSE)

4. cbind(deparse.level, ...)

3. cbind(prediction.frame, predictions)

2. as_tibble(x, ...)

1. as.tibble(cbind(prediction.frame, predictions))

The error message is self-explanatory, prediction.frame and predictions have different number of rows, we can't tell for sure why this is happening since you are not providing sample data and your example is not reproducible, but there is where you have to start looking for the cause.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.