title: Error in prediction in ROCR : Number of cross-validation runs must be equal for predictions and labels
body: <pre><code>brfssLRCleanData &lt;- read.csv('E:\\IEC\\Project 2\\BRFSS Data\\brfssLRCleanData.csv')
  selected_brfss &lt;- brfssLRCleanData %&gt;%
    select( X_RFBMI5 , X_RFSMOK3, DRNKANY5)
  
  selected_brfss &lt;- na.delete(selected_brfss)
  
  corr.matrix &lt;- cor(selected_brfss)
  corrplot(corr.matrix, main=&quot;\n\nCorrelation Plot of BMI, Smokers, Alcohol Drinkers and Age&quot;, method=&quot;number&quot;)
  
  #No any two numeric variables seem to have strong correlations
  
  #Logistic Regression to Predict Stroke
  
  stroke &lt;- brfssLRCleanData%&gt;%
    select( X_RFBMI5 , X_RFSMOK3, DRNKANY5, CVDSTRK3)
  
  stroke$X_RFBMI5 &lt;- as.factor(recode(stroke$X_RFBMI5, '1' = 'Yes', '2' = 'No', .missing = NULL,.default = NULL))
  stroke$X_RFSMOK3 &lt;- as.factor(recode(stroke$X_RFSMOK3, '1' = 'Yes', '2' = 'No', .missing = NULL,.default = NULL))
  stroke$DRNKANY5 &lt;- as.factor(recode(stroke$DRNKANY5, '1' = 'Yes', '2' = 'No', .missing = NULL,.default = NULL))
  stroke$CVDSTRK3 &lt;- as.factor(recode(stroke$CVDSTRK3, '1' = 'Yes', '2' = 'No', .missing = NULL,.default = NULL))
  stroke &lt;- na.delete(stroke)
  
  summary(stroke)
  
  #Logistic Regression Model Fitting
  
  
  #Use 80% of dataset as training set and remaining 30% as testing set
  sample &lt;- sample.split(stroke, SplitRatio = 0.8)
  train  &lt;- subset(stroke, sample == TRUE)
  test   &lt;- subset(stroke, sample == FALSE)
  
  model &lt;- glm(CVDSTRK3~., family=binomial(link = 'logit'), data=train)
  summary(model)
  
  anova(model, test=&quot;Chisq&quot;)
   
  fitted.results &lt;- predict(model,newdata=test,type='response')
  fitted.results &lt;- ifelse(fitted.results &gt; 0.5,&quot;Yes&quot;,&quot;No&quot;)
  
  misClasificError &lt;- mean(fitted.results != test$CVDSTRK3)
  print(paste('Accuracy',1-misClasificError))
  
  #ROC-curve using pROC library
  library(pROC)
  library(ROCR)
  p &lt;- predict(model, newdata=test, type=&quot;response&quot;)
  p &lt;- as.data.frame(p)
  pr &lt;- ROCR::prediction(p, test)
  prf &lt;- performance(pr, measure = &quot;tpr&quot;, x.measure = &quot;fpr&quot;)[,2]
  plot(prf)
  auc &lt;- performance(pr, measure = &quot;auc&quot;)
  auc &lt;- auc@y.values[[1]]
  auc
  </code></pre>
  <p>Error in line: pr &lt;- ROCR::prediction(p, test) is:
  Error in ROCR::prediction(p, test) :
  Number of cross-validation runs must be equal for predictions and labels.</p>
  <p>BRFSS is a survey data. it has values in Yes or NO only or 1 and 2. I am getting this error. can anyone help please?</p>