# How to specify VAR dynamics of factors in Dynamic Factor Model in R

I'm working on a forecasting model. The standard form for it is:

$y_t=\Lambda^*f_t+u_t\\f_t=A_1f_{t-1}+...+A_pf_{t-p}+e_t$

where $f_t$ is a vector of factors obtained from Principal Component Analysis that follows some VAR(p) dynamics. I have no problem with the PCA or the VAR estimation in my dataset, but I struggle with getting the Kalman filter right. I am trying to use R's dlm function, but the standard model specification there is:

$y_t=F^*f_t+u_t\\f_t=Gf_{t-1}+e_t$

I am aware that the dlm function should allow me to specify any dynamic I want for the factors to follow, as already mentioned in an answer on CV here, but I can't work out how to do that - do I create a block matrix with $A_1, ..., A_p$ blocks on the diagonal? If so, how do I then estimate the variance-covariance matrix (call it $E$) using the residuals from my VAR? How can I make the dimensions work? It seems to me that $E$ can only be a $k\times k$, where $k\times1$ is the dimension of $f_t$...