0 votes
1 view
in R Programming by (1.4k points)
edited by

I am using the mlogit package with R.

After importing my data using:

t <-read.csv('junk.csv',header=TRUE, sep=",", dec=".")
 

and call:

x <- mlogit.data(t,choice="D",shape="long",id.var="key",alt.var="altkey")
 

I am getting the following error:

Error in `row.names<-.data.frame`(`*tmp*`, value = c("1.1", "1.2", "1.3",  :
  duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘1.1’, ‘1.2’, ‘1.3’, ‘1.4’, ‘1.5’, ‘1.6’

Can you help me in fixing this?

My data exist in the following format in a csv file:

[junk.csv]
 

key,altkey,A,B,C,D
201005131,1,2.6,118.17,117,0
201005131,2,1.4,117.11,115,0
201005131,3,1.1,117.38,122,1
201005131,4,24.6,,122,0
201005131,5,48.6,91.90,122,0
201005131,6,59.8,,122,0
201005132,1,20.2,118.23,113,0
201005132,2,2.5,123.67,120,1
201005132,3,7.4,116.30,120,0
201005132,4,2.8,118.86,120,0
201005132,5,6.9,124.72,120,0
201005132,6,2.5,123.81,120,0
201005132,7,8.5,119.23,115,
 

Please log in or register to answer this question.

...