title: optim is giving errors from par input where fn = dlogis
body: <p>I don't know if this should be a new item or not. </p>
  
  <p>I modified the code to be:</p>
  
  <pre><code>library(Rcpp)
  
  rm(list = ls())
  
  datafile &lt;- data.frame(
    N = c(1.5, 2.6, 0.555555555555556, 0.535714285714286, 0.418604651162791, 0.557377049180328, 0.463157894736842, 0.762589928057554, 0.583673469387755, 0.528350515463918, 0.649241146711636, 0.534764826175869, 0.556295802798135, 0.250856164383562, 0.202258726899384, 0.351266723598064, 0.226669475458184, 0.1275974583548, 0.0906183368869936, 0.123027510124284, 0.119124595871674)
  )
  View(datafile)
  datafile$a&lt;-dlogis(datafile$N, location = 0, scale = 1, log = FALSE) 
  </code></pre>
  
  <p>datafile does not become 2 columns N rows.  It becomes 1 column N+1 rows where the datafile$a becomes one more entry.  </p>
  
  <hr>
  
  <p>I am wondering if anyone would know whether this is the problem my code with dlogis or with optim.<br>
  1) Console says I am running dlogis correct.<br>
  Console at the same time says I am not running it correctly when I call optim with dlogis.  What is the correct way to call optim with the below code?</p>
  
  <p>2) Also, when I call dlogis, I want to find the parameters location and scale so that the errors with the data I feed in can be minimized.  Are there other things I should pay attention?</p>
  
  <p>Thank you</p>
  
  <pre><code>library(Rcpp)
  
  rm(list = ls())
  
  datafile &lt;- data.frame(
    N = c(1.5, 2.6, 0.555555555555556, 0.535714285714286, 0.418604651162791, 0.557377049180328, 0.463157894736842, 0.762589928057554, 0.583673469387755, 0.528350515463918, 0.649241146711636, 0.534764826175869, 0.556295802798135, 0.250856164383562, 0.202258726899384, 0.351266723598064, 0.226669475458184, 0.1275974583548, 0.0906183368869936, 0.123027510124284, 0.119124595871674)
  )
  View(datafile)
  datafile$a&lt;-dlogis(datafile$N, location = 0, scale = 1, log = FALSE)
  View(datafile)
  
  optim(c(datafile$N, 0.5, 0.1), dlogis)
  </code></pre>
  
  <p>Console gives me this error msg:</p>
  
  <pre><code>&gt; optim(c(datafile$N, 0.5, 0.1), dlogis)
  Error in optim(c(datafile$N, 0.5, 0.1), dlogis) : 
    objective function in optim evaluates to length 23 not 1
  </code></pre>