Finding the mole fraction of nitrogen in a mixture of nitrogen and oxygen
OP has given a good effort to solve the problem using correct path. Only loose point was not considering the diatomic nature of the gases as Safdar Faisal pointed out in a comment. Suppose the amount of $\ce{O2}$ in the gas mixture is $n_1 \ \pu{mol}$ and the amount of $\ce{N2}$ in the gas mixture is $n_2 \ \pu{mol}$ in volume of $\pu{1.0 L}$ container. Thus, two parallel equations can be setup as follows:
$$PV = nRT \ \Rightarrow \ n_1 + n_2 = \frac{PV}{RT} = \frac{4 \times 1}{0.082 \times 298} = 0.164 \tag1$$
$$\frac{32n_1 + 28n_2}{1} = 4.7 \ \Rightarrow \ 32n_1 + 28n_2 = 4.7 \tag2$$
To resolve two parallel equations, take $(1) \times 32 - (2)$, which gives you,
$$(32-28)n_2 = 0.164 \times 32 - 4.7 = 0.538$$
$$\therefore \ n_2 = \frac{0.538}{4} = 0.135$$
Thus mole fraction of $\ce{N2}$ is $\chi_\ce{N2}$, then
$$\chi_\ce{N2} = \frac{n_2}{n_1 + n_2} = \frac{0.135}{0.164} = 0.820$$
Therefore, the mole fraction of $\ce{N2}$ in the mixture is $0.82$ (hence, the mole fraction of $\ce{O2}$ in the mixture is $0.18$).