\begin{Schunk}
\begin{Sinput}
 library(rstan)
 set.seed(234234)
 ## Manufacture data structures
 X <- model.matrix(~ x1 * x2 + x3f, dat)
 y <- dat$y 
 head(X)
\end{Sinput}
\begin{Soutput}
  (Intercept)          x1         x2 x3fmed x3fhi       x1:x2
1           1  0.04308983 -0.8373452      0     0 -0.03608106
2           1  0.26042677  0.1869587      1     0  0.04868904
3           1 -1.27029419  0.6448636      0     1 -0.81916651
4           1 -1.35175600  1.7507298      0     0 -2.36655951
5           1  1.80028444 -0.4759012      1     0 -0.85675755
6           1  1.88627714 -1.2192776      0     1 -2.29989542
\end{Soutput}
\end{Schunk}
