Counterexample to $M$ a $R$-module or rank $n$ then if $N\leq M$, $N$ is a $R$-module of rank $\leq n$ I've seen the following theorem

Let $R$ be a PID (principal ideal domain), If now $M$ is a free $R$-module of rank $n$ and $N\leq M$ a submodule then $N$ is a free $R$-module of rank $\leq n$.

I would like to see the dependence on the PID through a counterexample.
Can I build some counterexample with $(2,x) \trianglelefteq \mathbb{Z}[x]$? 
Could anything of the following be used?
Let $R=\mathbb{Z}[x]$ and $M=\mathbb{Z}[x]$ be a $R$-module then $\{1\}$ is a basis of $M$. Because, choose a $f\in M$, then it is possible to create it through choosing $\phi = f \in R$ and considering $\phi \cdot 1 = f$. Now consider $N=(2,x)$ which is submodule of $M$ (right?)
I'm somewhat confused of the rank of $N$ now. $\{1\}$ still seems to be a generator for the module? But this generates to much?

Take any non-PID $R$ and a projective $R$-module that isn't free. One definition of projective module is that $P$ is projective if there exists $N$ such that $P \oplus N$ is a free $R$-module. In this case $P$ is a submodule of the free module $P \oplus N$ but it's not free.
If $R$ is local or a PID then a projective $R$-module is free.
For example, you can take $R = \mathbb{Z}/2\mathbb{Z} \times \mathbb{Z}/2\mathbb{Z}$ and then the module $M = \mathbb{Z}/2\mathbb{Z} \times 0$. This is clearly a direct summand of $R$ itself, but it's not free.
