0

I am running a panel regression in R and have called my data set with the variables listed and i get an error message when i run the model that says:

"Error in `[[<-.data.frame`(`*tmp*`, time.name, value = c(1L, 2L, 3L, 4L,  :replacement has 83498 rows, data has 83765" 

I have no idea what this means and am trying to figure it out. I have my CSV and it has no NA's or missing values or anything i've already double checked. Here is the code.

Within.Model=plm(Cancelled~Length.Of.Agreement+Total.Contract.Value+Easy.Pay..Yes.or.No,data=Data,index="Year",model="within",effect("time"))

Any help would be appreciated.

Robin Gertenbach
  • 10,316
  • 3
  • 25
  • 37
  • 1
    Please provide a reproducible example with some example data that lets us reproduce the problem – Robin Gertenbach Jun 08 '18 at 19:29
  • The company i work for is very particular about the data and won't let me actually post it. Is there no way to get help on this? What things am i missing to allow this to be solvable? – StanimalD Jun 08 '18 at 22:43
  • You can have a look at [this function](https://stackoverflow.com/questions/10454973/how-to-create-example-data-set-from-private-data-replacing-variable-names-and-l/10458688#10458688) for a way to make an anonymized version of your data. I would also try subsetting your data and rerunning the model to see if there's only certain rows that create the problem. – Esther Jun 09 '18 at 01:56
  • What do you mean by subsetting my data? I'm pretty inexperienced in R. I have had to teach myself most of it so i'm pretty bad at it. – StanimalD Jun 11 '18 at 21:25
  • Try running the model with just part of your dataframe i.e., `data=Data[1:500,]` to see if that returns the same kind of error. Or remove some of the model variables. See if you can narrow down where in your data produces the error. If you could share at least a few lines of your data, `dput(head(Data))` that might help us too. – Esther Jun 12 '18 at 23:22

0 Answers0