Projective space is not affine
Solution 1:
First, let us review the definition of an affine scheme. An affine scheme $X$ is a locally ringed space isomorphic to $\operatorname{Spec} A$ for some commutative ring $A$. This means that if one knows one has an affine scheme $X$, then all one has to do to recover $A$ such that $X=\operatorname{Spec} A$ is to take global sections of the structure sheaf, ie $A\cong\Gamma(X,\mathcal{O}_X)$.
In order to prove that $\mathbb{P}^n_R$ is not affine, it suffices to show that $\operatorname{Spec}(\Gamma(\mathbb{P}^n_R,\mathcal{O}_{\mathbb{P}^n_R}))\cong \operatorname{Spec} R$ is not isomorphic to $\mathbb{P}^n_R$. This is due to a dimension argument- assume $R$ is noetherian, and $\dim R=d$. Then $\dim\mathbb{P}^n_R=d+n$, as $\dim R[x_1,\cdots,x_n]=d+n$. Unless $n=0$, the two cannot be isomorphic.
Solution 2:
Here is a proof that does not need dimension argument and Noetherian assumptions. Set $X$ to be $\mathbb{P}^n_R$. Then $X=Spec (R)$ means that the map $X\to Spec (R)$ by glueing $n+1$ maps $U_i=Spec (R[T_1,\dots,T_n])\to Spec (R)$ is isomorphic. This is contrary to the fact that the map $U_1 \to Spec (R)$ is surjective and $U_1\neq X.$ The map $U_1 \to Spec (R)$ is surjective since for each $\mathfrak{p}\in Spec (R)$, $(\mathfrak{p},T_1,\dots,T_n)\in U_1$ which is mapped to $\mathfrak{p}.$ And $U_1\neq X$ since $(\mathfrak{p},T_1,\dots,T_n)\in U_2-U_1$ for some prime ideal of $R.$