Re: [R] Unexpected result with lag() et diff() in plm package.

2011-11-22 Thread James Ryans
I didn't see you got an answer posted to this question: You can't modify a pdata.frame object. Your transforms turn it back to a normal data frame and diff and lag won't work as expected. Try: Grunfeld.p - pdata.frame(Grunfeld,c(firm,year)) tmp - transform(Grunfeld.p, d.value =

[R] Unexpected result with lag() et diff() in plm package.

2011-06-18 Thread Michael Ash
I have an unexpected result with the functions lag() and diff() in the plm (panel data) package when used with transform(). These plm-specific functions are supposed to generate lags and first differences within each panel. lag() does not work properly the first time (it reproduces the same