I use a within plm model:
plm
model <- plm(Y ~ x1 + x2 + x3, data=dataset, model="within", effect="twoways")