Please note: I am trying to get the code to work with both time & individual fixed effects, and an unbalanced dataset. The sample code below works
This works for an unbalanced data with effect="individual" and time dummies y ~ x +factor(year):
effect="individual"
y ~ x +factor(year)
fitted <- pmodel.response(plm.model)-residuals(plm.model)