TFP estimation in R by using prodest and estprod packages
You get the error because your ID is string and the prodestLP function has a problem with that here - leading to incorrectly specifying that replacement matrix in this case.
You can solve this issue with:
 DataA$ID&lt;-as.numeric(as.factor( DataA$ID))

once you declare the ID as numeric the code works:
     mod2 = prodest::prodestLP(DataA$va,
+                            fX = DataA$l,
+                            sX = DataA$k, 
+                            pX = DataA$m,
+                            idvar = DataA$ID,
+                            timevar = DataA$Year,
+                            opt='optim',
+                            exit = FALSE,
+                            tol = 1e-100)  
&gt;  
&gt;  omega = prodest::omega(mod2) 

with output:
    summary(mod2)

-------------------------------------------------------------
-               Production Function Estimation              -
-------------------------------------------------------------
                   Method :    LP              
-------------------------------------------------------------
                               fX1       sX1 
Estimated Parameters      :   0.107     0.458 
                             (0.012)   (0.052)
-------------------------------------------------------------
N                         :  4397
-------------------------------------------------------------
Bootstrap repetitions     :  20
1st Stage Parameters      :  0.107     0.249 
Optimizer                 :  optim
-------------------------------------------------------------
Elapsed Time              :  0.02 mins

-------------------------------------------------------------


summary(omega)
       V1        
 Min.   :-3.452  
 1st Qu.: 1.428  
 Median : 1.842  
 Mean   : 1.778  
 3rd Qu.: 2.202  
 Max.   : 4.492  


Update these are the packages I am running and code before the one shown above (also I am running R  version 4.0.2 (2020-06-22)):
rm(list = ls())

Data &lt;- read.csv(&quot;~/R studio/excercises in randomness/tfp2/Gmail/LV.csv&quot;)

 View(Data)
 
 
 

 pckg&lt;-c(&quot;plm&quot;,&quot;readxl&quot;,&quot;dplyr&quot;,&quot;ggplot2&quot;, &quot;broom&quot;,&quot;prodest&quot;, &quot;estprod&quot;)
 #install.packages(c(&quot;plm&quot;,&quot;readxl&quot;,&quot;dplyr&quot;,&quot;ggplot2&quot;, &quot;broom&quot;,&quot;prodest&quot;, &quot;estprod&quot;))
 lapply(pckg, require, character.only = TRUE)
 
 head(Data)
 
 summary(Data)
 
 DataA &lt;- Data %&gt;% 
         filter(NACE == 'A') %&gt;% 
         filter(VA &gt; 0, L &gt; 0, K &gt; 0, M &gt; 0) %&gt;%
         mutate(l = log(L),
                va = log(VA),
                k = log(K),
                m = log(M))