title: Plotting Logistic Regression in R, but I keep getting errors
body: <p>I'm trying to plot a logistic regression in R, for a continuous independent variable and a dichotomous dependent variable. I have very limited experience with R, but my professor has asked me to add this graph to a paper I'm writing, and he said R would probably be the best way to create it. Anyway, I'm sure there are tons of mistakes here, but this is the sort of this previously suggested on StackOverflow:</p>
  
  <pre><code>ggplot(vvv, aes(x = vvv$V1, y=vvv$V2)) + geom_point() + stat_smooth(method="glm", family="binomial", se=FALSE) 
  curve(predict(ggg, data.frame(V1=x), type="response"), add=TRUE)     
  </code></pre>
  
  <p>where vvv is the name of my csv file (31 obs. of 2 variables), V1 is the continuous variable, and V2 is the dichotomous one. Also, ggg (List of 30?) is the following:</p>
  
  <pre><code>ggg&lt;- glm(formula = vvv$V2 ~ vvv$V1, family = "binomial", data = vvv)    
  </code></pre>
  
  <p>The ggplot function produces a graph of my data points, but no logistic regression curve. The curve function results in the following error:</p>
  
  <pre><code> "Error in curve(predict(ggg, data.frame(V1 = x), type = "resp"), add = TRUE) : 'expr' did not evaluate to an object of length 'n'    
  
  In addition: Warning message:'newdata' had 101 rows but variables found have 31 rows"    
  </code></pre>
  
  <p>I'm not sure what the problem is, and I'm having trouble finding resources for this specific issue. Can anybody help? It would be greatly appreciated :)</p>
  
  <p>Edit: Thanks to anyone who responded! My data, vvv, is the following, where the percent was the initial probability for presence/absence of a species in a specific area, and the 1 and 0 indicate whether or not a species ended up being observed.:</p>
  
  <pre><code>    V1  V2
  1   95.00%  1
  2   95.00%  0
  3   95.00%  1
  4   92.00%  1
  5   92.00%  1
  6   92.00%  1
  7   92.00%  1
  8   92.00%  1
  9   92.00%  1
  10  92.00%  1
  11  85.00%  1
  12  85.00%  1
  13  85.00%  1
  14  85.00%  1
  15  85.00%  1
  16  80.00%  1
  17  80.00%  0
  18  77.00%  1
  19  77.00%  1
  20  75.00%  0
  21  70.00%  1
  22  70.00%  0
  23  70.00%  0
  24  70.00%  1
  25  70.00%  0
  26  69.00%  1
  27  65.00%  0
  28  60.00%  1
  29  50.00%  1
  30  35.00%  0
  31  25.00%  0
  </code></pre>