Skip to content
Prev 385739 / 398503 Next

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

@Rahul;


You need to learn to post in plain text and attachments may not be xls 
or xlsx. They need to be text files. And even if they are comma 
separated files and text, they still need to be named with a txt extension.


I'm the only one who got the xlsx file. I got the error regardless of 
how many column I omitted, so my gues was possibly incorrect. But I did 
RTFM. See ?mlogit.datadfi The mlogit.data function is deprecated and you 
are told to use the dfidx function. Trying that you now get an error 
saying: " the two indexes don't define unique observations".


 > sum(duplicated( dfrm[,1:2]))
[1] 12
 > length(dfrm[,1])
[1] 18

So of your 18 lines in the example file, most of them appear to be 
duplicated in their first two rows and apparently that is not allowed by 
dfidx.


Caveat: I'm not a user of the mlogit package so I'm just reading the 
manual and possibly coming up with informed speculation.

Please read the Posting Guide. You have been warned. Repeated violations 
of the policies laid down in that hallowed document will possibly result 
in postings being ignored.