I have data which looks like this:
## # A tibble: 6 x 7
## sampleno h0 h1 h2 h3 h4 correct_hyp_no
##<dbl> <dbl> <dbl> <dbl> <dbl> <dbl><dbl>
## 1 0 7498 7147 7137 7003 7003 0
## 2 1 7349 7133 7104 7065 6960 0
## 3 2 6907 6676 6671 6575 6575 0
## 4 3 7339 7267 7133 7089 7051 0
## 5 4 5378 5316 5248 5205 5171 NA
## 6 5 7411 7253 7233 7137 7118 4
When I run
mlogit(correct_hyp_no ~ h0 + h1 + h2 + h3 + h4, my_data)
I get an error
Error in data.frame(lapply(index, function(x) x[drop = TRUE]), row.names = rownames(mydata)) : row names supplied are of the wrong length
I'm fairly new to R. I didn't explicitly name rows, but it looks like it's automatically picked up 1,2,3,4,5,6 as names. What's going wrong, please?