title: I get an error [invalid type (list) for variable '(weights)'] while using the rpart function for decision trees in R
body: <p>These are the commands I am using in R:</p>
  
  <p>Outcome_factor= factor(train$Outcome)
  rpart_model= rpart(Outcome_factor~., data=train, method='class',rpart.control(minsplit = 2, cp = 0))</p>
  
  <p>The dataset "train" has the variables: Outcome,Pregnacies, Glucose, Blood Pressure, Skin Thickness, Insulin, BMI, Age, and DiabetesPedigreefunction..</p>
  
  <p>I get the following message:
  Error in model.frame.default(formula = Outcome_factor ~ ., data = train,  : 
    invalid type (list) for variable '(weights)'</p>
  
  <p>I also noticed that this error message disappears if I dont use the repart.control parameter while calling rpart function. Can someone please help me understand why I might be getting this error?</p>