title: Logistic regression - eval(family$initialize) : y values must be 0 <= y <= 1
body: <p>I am trying to perform logistic regression using R in a dataset provided here : <a href="http://archive.ics.uci.edu/ml/machine-learning-databases/00451/" rel="nofollow noreferrer">http://archive.ics.uci.edu/ml/machine-learning-databases/00451/</a>
  It is about breast cancer. This dataset contains a column <em>Classification</em> which contains only <strong>1</strong> (if patient doesn't have cancer) or <strong>2</strong> (if patient has cancer)</p>
  <pre><code>library(ISLR)
  dataCancer &lt;- read.csv(&quot;~/Desktop/Isep/Machine 
  Leaning/TD/Project_Cancer/dataR2.csv&quot;)
  attach(dataCancer)
  
  
  
  #Step : Split data into training and testing data
  training = (BMI&gt;25)
  testing = !training
  training_data = dataCancer[training,]
  testing_data = dataCancer[testing,]
  
  Classification_testing = Classification[testing]
  
  #Step : Fit a logistic regression model using training data
  
  classification_model = glm(Classification ~ ., data = 
  training_data,family = binomial )
  </code></pre>
  <p>When running my script I get :</p>
  <pre><code>&gt; classification_model = glm(Classification ~ ., data = training_data,family = binomial )
  Error in eval(family$initialize) : y values must be 0 &lt;= y &lt;= 1
  &gt; summary(classification_model)
  Error in summary(classification_model) : object 'classification_model' not found . 
  </code></pre>
  <p>I added <code>as.factor(dataCancer$Classification)</code> as seen in other posts but it has not solved my problem.
  Can you suggest me a way to have a classification's value between 0 and 1 if it is the content of this predictor?</p>