I am doing a Discrete Choice Analysis using mlogit.
As I run the mlogit.data, I am getting an error. There are no empty rows or columns. Please help me!
Convert to mlogit format
df_mlogit <- mlogit.data(df_expanded,
-
choice = "chosen",
-
shape = "long",
-
alt.var = "Alternative",
-
id.var = "ID_Choice_Set",
-
drop.index = FALSE)
Error in $<-
:
! Assigned data rep(1:nchid, each = nalts)
must be compatible with existing data.
Existing data has 6660 rows.
Assigned data has 6655 rows.
Only vectors of size 1 are recycled.
Caused by error in vectbl_recycle_rhs_rows()
:
! Can't recycle input of size 6655 to size 6660.
Run rlang::last_trace()
to see where the error occurred.