title: R mlogit error : Error in .subset2(x, i, exact = exact) : no such index at level 1
body: <p>I have a wide data set that I have converted into long format for estimating in mlogit. In the data I have NO alternative specific data, the values are the same for all alternatives.</p>
  
  <pre><code>str(f)
  'data.frame':   60 obs. of  6 variables:
   $ Outcome: logi  FALSE TRUE FALSE FALSE FALSE FALSE ...
   $ X1     : num  0.00437 0.00437 0.00437 0.00437 0.00437 ...
   $ X2     : num  0.00617 0.00617 0.00617 0.00617 0.00617 ...
   $ X3     : num  0.00257 0.00257 0.00257 0.00257 0.00257 ...
   $ chid   : int  1 1 1 1 1 1 2 2 2 2 ...
   $ alt    : chr  "L1" "L2" "L3" "L4" ...
  </code></pre>
  
  <p>when I try to estimate a model,</p>
  
  <pre><code>model&lt;-mlogit(Outcome~X1+X2+X3,data=f,shape="long",choice="Outcome",alt.var=f$alt)
  </code></pre>
  
  <p>If alt is type char I get this error message:</p>
  
  <blockquote>
    <p>Error in .subset2(x, i, exact = exact) : no such index at level 1</p>
  </blockquote>
  
  <p>If alt is factor I get this:</p>
  
  <blockquote>
    <p>Error in .subset2(x, i, exact = exact) :    recursive indexing failed
    at level 2</p>
  </blockquote>
  
  <p>I have not found any help in regards to these messages in connection with mlogit.</p>
  
  <p>Here is the truncated data I have used (the full data set has 3900 rows). mlogit appears to be very strict about its data. Thanks.</p>
  
  <pre><code>structure(list(Outcome = c(FALSE, TRUE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, 
  TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 
  FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 
  FALSE), X1 = c(0.004373668, 0.004373668, 0.004373668, 0.004373668, 
  0.004373668, 0.004373668, 0.00237986, 0.00237986, 0.00237986, 
  0.00237986, 0.00237986, 0.00237986, 0.008879354, 0.008879354, 
  0.008879354, 0.008879354, 0.008879354, 0.008879354, 0.003356421, 
  0.003356421, 0.003356421, 0.003356421, 0.003356421, 0.003356421, 
  0.004611897, 0.004611897, 0.004611897, 0.004611897, 0.004611897, 
  0.004611897, 0.003225387, 0.003225387, 0.003225387, 0.003225387, 
  0.003225387, 0.003225387, 0.003495294, 0.003495294, 0.003495294, 
  0.003495294, 0.003495294, 0.003495294, 0.003639481, 0.003639481, 
  0.003639481, 0.003639481, 0.003639481, 0.003639481, 0.004911368, 
  0.004911368, 0.004911368, 0.004911368, 0.004911368, 0.004911368, 
  0.004165713, 0.004165713, 0.004165713, 0.004165713, 0.004165713, 
  0.004165713), X2 = c(0.006167994, 0.006167994, 0.006167994, 0.006167994, 
  0.006167994, 0.006167994, 0.003977765, 0.003977765, 0.003977765, 
  0.003977765, 0.003977765, 0.003977765, 0.004830369, 0.004830369, 
  0.004830369, 0.004830369, 0.004830369, 0.004830369, 0.004058219, 
  0.004058219, 0.004058219, 0.004058219, 0.004058219, 0.004058219, 
  0.004064723, 0.004064723, 0.004064723, 0.004064723, 0.004064723, 
  0.004064723, 0.004226818, 0.004226818, 0.004226818, 0.004226818, 
  0.004226818, 0.004226818, 0.004199124, 0.004199124, 0.004199124, 
  0.004199124, 0.004199124, 0.004199124, 0.004917811, 0.004917811, 
  0.004917811, 0.004917811, 0.004917811, 0.004917811, 0.00424221, 
  0.00424221, 0.00424221, 0.00424221, 0.00424221, 0.00424221, 0.005516136, 
  0.005516136, 0.005516136, 0.005516136, 0.005516136, 0.005516136
  ), X3 = c(0.002565325, 0.002565325, 0.002565325, 0.002565325, 
  0.002565325, 0.002565325, 0.001206929, 0.001206929, 0.001206929, 
  0.001206929, 0.001206929, 0.001206929, 0.001917941, 0.001917941, 
  0.001917941, 0.001917941, 0.001917941, 0.001917941, 0.001922314, 
  0.001922314, 0.001922314, 0.001922314, 0.001922314, 0.001922314, 
  0.003243962, 0.003243962, 0.003243962, 0.003243962, 0.003243962, 
  0.003243962, 0.001443621, 0.001443621, 0.001443621, 0.001443621, 
  0.001443621, 0.001443621, 0.00214728, 0.00214728, 0.00214728, 
  0.00214728, 0.00214728, 0.00214728, 0.001188095, 0.001188095, 
  0.001188095, 0.001188095, 0.001188095, 0.001188095, 0.002095854, 
  0.002095854, 0.002095854, 0.002095854, 0.002095854, 0.002095854, 
  0.002529183, 0.002529183, 0.002529183, 0.002529183, 0.002529183, 
  0.002529183), chid = c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
  2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 
  5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 
  8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 
  10L, 10L, 10L), alt = c("L1", "L2", "L3", "L4", "L5", "L6", "L1", 
  "L2", "L3", "L4", "L5", "L6", "L1", "L2", "L3", "L4", "L5", "L6", 
  "L1", "L2", "L3", "L4", "L5", "L6", "L1", "L2", "L3", "L4", "L5", 
  "L6", "L1", "L2", "L3", "L4", "L5", "L6", "L1", "L2", "L3", "L4", 
  "L5", "L6", "L1", "L2", "L3", "L4", "L5", "L6", "L1", "L2", "L3", 
  "L4", "L5", "L6", "L1", "L2", "L3", "L4", "L5", "L6")), .Names = c("Outcome", 
  "X1", "X2", "X3", "chid", "alt"), row.names = c(NA, -60L), class = "data.frame")
  </code></pre>