Skip to content
Prev 385752 / 398503 Next

Help with the Error Message in R "Error in 1:nchid : result would be too long a vector"

David,

My apologies with the first one. I was checking different tutorials on
mlogit where they were using mlogit.data, so I ended up using it.

I am not getting what you are saying by the "duplicates in first two
columns". See, my first column is IND which identifies my individuals,
second column is QES which identifies the question number each
individual faces, 3rd column is a stratification code that can be
ignored. Columns 6-13 are alternative specific variables and rest are
individual specific. So 1st 3 rows indicate 1st question faced by 1st
individual containing 3 alternatives, and so on. So, I have already
arranged the data in long format. Here, I could not get what the
"duplicate in first two columns" mean.


And I am really sorry that there was an error in my code as Rui has
pointed out. The correct code is
mldata1 <- dfidx(mydata, shape = "long",
                  alt.var = "ALT_name",
                  choice = "Choice_binary",
                  id.var = "IND")

It still shows the error-  "the two indexes don't define unique observations"
It would be really helpful if you kindly help.

Regards,
On Tue, Sep 22, 2020 at 8:46 PM David Winsemius <dwinsemius at comcast.net> wrote: