confusion matrix

Hello I'm getting this error while I'm triying to get the confusion matrix after a prediction.

mc = table(test$barbecue , pred0)
Error in table(test$barbecue, pred0) : 
  all arguments must have the same length

I've tried to fixe it via some solution available but it does not work.