Help on an Old Script...

#1
In 2015 this worked with R

library(csvread)
library(mlogit)
y <- read.csv("C:/Users/MIKEPC/Desktop/book2.csv")
map.coltypes("C:/Users/MIKEPC/Desktop/book2.csv", header = TRUE, nrows = 100, delimiter = ",")
x <- mlogit.data(y,choice="winpayoff",shape="long",id.var="id",alt.var="horsename")
summary(mlogit(winpayoff ~ nFR1+nFR2+nFR3 -1, data = x))

With latest R , I get this

> library(csvread)>
> library(mlogit)
Loading required package: dfidx
Attaching package: ‘dfidx’
The following object is masked from ‘package:stats’:
filter

> y <- read.csv("C:/Users/MIKEPC/Desktop/book2.csv")
>
> map.coltypes("C:/Users/MIKEPC/Desktop/book2.csv", header = TRUE, nrows = 100, delimiter = ",")
id horsename nFR1 nFR2 nFR3 winpayoff
"integer" "integer" "double" "double" "double" "integer"
>
> x <- mlogit.data(y,choice="winpayoff",shape="long",id.var="id",alt.var="horsename")
Error in dfidx::dfidx(data = data, dfa$idx, drop.index = dfa$drop.index, :
impossible to coerce the choice variable to a logical
>
>
>
> summary(mlogit(winpayoff ~ nFR1+nFR2+nFR3 -1, data = x))

can this get to be working again?

Thank you
 

hlsmith

Less is more. Stay pure. Stay poor.
#3
Yes some times functions get "deprecated". Do you need to generate approximately the exact same results or exactly? Or would using a comparable package work? Both would likely generate the some output to an important level of decimals.