Consider a function $f: R \to R$ that fulfills the following two properties: $f$ is periodic of period $5$ (that is, for all $x\in R$, $f (x + 5) = f (x)$), and by restricting $f$ to the interval $[-2,3]$, $f$ coincides to $x^2$. Determine the value of $f(2018).$