title: How do I change model coefficients to compare a model in the literature?
body: <p>I'd like to compare the coefficients from my own replication of a statistical model in the literature with the coefficients in the literature. I thougth I could just duplicate my model, and then plug in the coefficients from the literature and print both. But I'm getting this error:</p>
  
  <p><code>Error in if (coef.var[i] == .global.coefficient.variables[j]) { : 
    argument is of length zero</code></p>
  
  <p>What is the easiest way to do this?</p>
  
  <pre><code>##fake data
  var1&lt;-rnorm(100)
  var2&lt;-rnorm(100)
  df&lt;-data.frame(var1, var2)
  #My own model
  model1&lt;-lm(var1~var2, data=df)
  
  #Duplicate my own model
  model2&lt;-model1
  #Try to change the coefficients to match what appears in the literature
  model2$coefficients&lt;-c(5, 10)
  #Try to report
  library(stargazer)
  stargazer(model1, model2,type="html")
  </code></pre>