prodest icon indicating copy to clipboard operation
prodest copied to clipboard

Error when idvar is a string (R)

Open ghost opened this issue 3 years ago • 1 comments

Hello.

I have an unbalanced data panel, where the firm ID is a string.

I was trying to get the Levinsohn-Petrin estimation.

This was my code

levpet <- prodestLP(base2$c_y, # log of value added
                    fX=base2$c_l, # log of wages
                    sX=base2$c_k, # log of capital
                    pX=base2$c_m, # log of materials
                    idvar=base2$ruc, # string id
                    timevar = base2$year, # numeric variable
                    R=30  )

And I got this error:

Error in `[[<-.data.frame`(`*tmp*`, i, value = c(42719L, 82109L, 82678L,  : 
  replacement has 469326 rows, data has 78221

I don´t really know what´s the error or if this counts as a bug

But I created a numeric firm id and it worked.

ghost avatar Aug 07 '21 22:08 ghost

Thank you so much for this. I was having the same issue with ´prodestOP´ and changing the character variable to numeric variable helped.

l-teefah avatar Apr 28 '24 11:04 l-teefah