0

I'm trying to replicate some work and running into a dataframe error. I'm trying to subset just year 2011 of my data. And show the difference in the lag between my two variables (LnCO & LnPP).

Data Formating for PP Regressions

PP$LnCO_diff1 <- PP$LnCO - PP$LnCO_1

This is the error I am receiving:

Error in `$<-.data.frame`(`tmp`, "LnCO_diff1", value = numeric(0)) : replacement has 0 rows, data has 433

I'm fairly new to R and have no idea. Any help is appreciated!

Uwe
  • 41,420
  • 11
  • 90
  • 134
Jchin
  • 1
  • 1
  • 1
    can you provide a [reproducible example](http://stackoverflow.com/help/mcve), especially [one for r](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? `mtcars$fake = mtcars$gear-mtcars$carb` works fine. – desc Sep 13 '16 at 19:37
  • Please, show the contents of PP, or show what `str(PP)` returns at least. – Uwe Sep 21 '16 at 09:43

0 Answers0