Answer
See the detailed answer below.
Work Step by Step
The dashed circles on the left figure represent the Gaussian cylindrical surfaces of radius $r$ and height $h$.
The height of the two Gaussian cylindrical surfaces is the same since we are working on changing the radius, not the length.
We will use the Gauss's law of
$$\oint \vec Ed\vec A=\dfrac{Q_{in}}{\epsilon_0}$$
$$\color{blue}{\bf [a]}$$
When $r\lt R$;
$$\oint \vec Ed\vec A=\dfrac{Q_{in}}{\epsilon_0}$$
$$\int_{\rm top} \vec Ed\vec A+\int_{\rm bottom} \vec Ed\vec A+\int_{\rm sides} \vec Ed\vec A=\dfrac{Q_{in}}{\epsilon_0}$$
Assuming that the electric field is uniform and constant inside the Gaussian cylinder.
$$0+0+ EA_{\rm sides}=\dfrac{Q_{in}}{\epsilon_0}$$
where $E=0$ on the top and the bottom of the Gaussian cylinder.
Solving for $E$
$$E=\dfrac{Q_{in}}{A_{\rm sides}\epsilon_0}$$
where $A_{\rm sides}=2\pi r h$;
$$E=\dfrac{Q_{in}}{2\pi r h\epsilon_0}\tag 1$$
Now we need to find the enclosed charge for our Gaussian cylinder which is given by
$$\lambda=\dfrac{Q_{\rm wire}}{L_{\rm wire}}=\dfrac{Q_{in}}{h}$$
Hence,
$$Q_{in}=h\lambda$$
Plug into (1),
$$E=\dfrac{h\lambda}{2\pi r h\epsilon_0}$$
$$E=\dfrac{ \lambda}{2\pi \epsilon_0}\dfrac{1}{r}$$
And since $\lambda$ is positive, the direction of the electric field is outward away from the center of the cylinder.
$$\boxed{\vec E=\dfrac{ \lambda}{2\pi \epsilon_0}\dfrac{1}{r}\;\hat r}\tag{Outward}$$
$$\color{blue}{\bf [b]}$$
When $r\gt R$;
By the same approach, from (1),
Now we need to find the enclosed charge for our Gaussian cylinder, so we need to use the volume charge density
$$\rho_e=\dfrac{Q}{V}=\dfrac{Q_{in}}{V}$$
where $Q$ is the total charge of the infinite cylinder and $V$ is its volume.
$$ \dfrac{Q}{\pi R^2 L}=\dfrac{Q_{in}}{\pi r^2 h} $$
Hence,
$$Q_{in}=\dfrac{Q r^2h}{R^2L}$$
where $\lambda=Q/L$
$$Q_{in}=\dfrac{\lambda r^2h}{R^2}$$
Plug into (1),
$$E=\dfrac{ \lambda r^2h}{2\pi r h \epsilon_0R^2 } $$
$$\boxed{\vec E=\dfrac{ \lambda}{2\pi \epsilon_0}\dfrac{r}{R^2}\;\hat r}\tag{Outward}$$