0

I am learning how to use mlogit package. These are some lines that appear as an example in a vignette of the package:

data("Heating", package = "mlogit")
H <- dfidx(Heating, choice = "depvar", varying = c(3:12))

However, when I want to view df H, I keep getting the same error: r error 4 (R code execution error)

This is the error that appears in the console:

Error in [.data.frame(x, start:min(NROW(x), start + len)) : undefined columns selected

The funny thing is that if a restart R, I can view the df. It seems that the problem is created when I want to use the package mlogit.

Any hint what could be going on?

  • have you loaded the package i.e. `library(mlogit)` – akrun May 21 '22 at 16:58
  • Yes, I have. I get the error when I try to view the df after applying dfidx. – Daniel Ruiz May 21 '22 at 17:09
  • I couldn't reproduce your error though – akrun May 21 '22 at 17:09
  • Could it be some kind of incompatibility with the dfidx/mlogit packages? I can view the df when I restart R but I cannot view it when I re-upload either package. – Daniel Ruiz May 21 '22 at 17:22
  • I used `packageVersion("dfidx") [1] ‘0.0.4’ > packageVersion("mlogit") [1] ‘1.1.1’` – akrun May 21 '22 at 17:23
  • When I load mlogit I get the following warning: > library("mlogit") Loading required package: dfidx Attaching package: ‘dfidx’ The following object is masked from ‘package:stats’: filter Could that explain the problem? – Daniel Ruiz May 21 '22 at 17:55
  • that is a friendly message stating the masked function. There is nothing wrong in that – akrun May 21 '22 at 17:56

0 Answers0