I am struggling with some code that I need for data management. I apologise in advance because I am sure it has a quite simple solution, but I could not find any information elsewhere.
I am analysing data in long format using the mlogit command in R. For each choice set, one alternative should be chosen; otherwise the mlogit command fails with the following error:
Error in if (abs(x - oldx) < ftol) { :
missing value where TRUE/FALSE needed
For my dataset, there are indeed some choice sets where no alternative is chosen. My question is therefore: How can I delete the all rows of a choice set where no alternative is chosen? In this example, I wish to delete all rows for ID 2, since no choice is made by this respondent:
i.e., the value of the choice variable is always "FALSE".
Any help much appreciated!