Since $f:\ {\mathbb R}\to{\mathbb R}^2$ is only required to be surjective you can even construct a continuous $f$ doing the trick:
Take your favorite Peano curve in the unit square, i.e., a continuous surjective function $\phi:\ [0,1]\to[0,1]^2$. Put $\phi(0)=: a$, $\phi(1)=:b$.
Number the integer squares $[j,j+1]\times[k,k+1]$ with even numbers $2\ell$ going from $-\infty$ to $\infty$, such that $[0,1]^2$ becomes $Q_0$, and you have two symmetrically outward going "spirals" of sequentially adjacent squares $Q_2$, $Q_4$, $Q_6$, $\ldots$, resp., $Q_{-2}$, $Q_{-4}$, $\ldots$, covering the whole plane. Denote the lower left corner of $Q_{2\ell}$ by $z_{2\ell}$.
Then for each $\ell\in{\mathbb Z}$ use the $t$-interval $[2\ell, 2\ell+1]$ to cover $Q_{2\ell}$ with a Peano curve by putting $f(t):=z_{2\ell}+\phi(t-2\ell)\qquad(2\ell\leq t\leq 2\ell+1)\ .$ Finally for each $\ell\in{\mathbb Z}$ use the $t$-interval $[2\ell+1, 2\ell+2]$ to connect the endpoint of the Peano curve in $Q_{2\ell}$ with the initial point of the Peano curve in $Q_{2(\ell +1)}$: $f(t):=(2\ell+2-t)(z_{2\ell}+b)+(t-2\ell-1)(z_{2(\ell+1)}+a)\qquad(2\ell+1\leq t\leq 2\ell+2)\ .$