TITLE: Is $\operatorname{Hom}_R(R,G)\cong G$?
QUESTION [5 upvotes]: In this question (How to show that for any abelian group $G$, $\text{Hom}(\mathbb{Z},G)$ is isomorphic to $G$), it is shown that $\operatorname{Hom}_\mathbb{Z}(\mathbb{Z},G)\cong G$, where $G$ is an abelian group (i.e. $\mathbb{Z}$-module).
When we generalize to $R$-modules, can we still say $$\operatorname{Hom}_R(R,G)\cong G ?$$ (isomorphic as $R$-modules)
($R$ is a commutative ring with 1, $G$ is an $R$-module).
I tried using the same isomorphism $\phi: \operatorname{Hom}_R(R,G)\to G$ defined by $f\mapsto f(1)$. It seems to work out; $\phi$ is an $R$-module homomorphism. It is injective since if $f(1)=0$, then $f(r)=rf(1)=0$ for all $r\in R$, so $f$ is the zero homomorphism. It is surjective since any for any $g\in g$, we can define a $f\in \operatorname{Hom}_R(R,G)$ such that $f(1)=g$, and then $f(r)=rf(1)=rg$ for any $r\in R$.
Is the above reasoning correct? Thanks.

REPLY [4 votes]: Yes, your reasoning is perfectly good.
I wish to note that this is a very general effect: for any category of algebraic structures of some sort, we have $\operatorname{Hom}(F,X)\cong X$, where $X$ is any algebraic structure of this type, $F$ is the free structure generated by a single element, and $\operatorname{Hom}$ is the set of homomorphisms in an appropriate sense. One says that the underlying set functor in this category is represented by $F$.
In the case of $R$-modules, $F$ is the free cyclic $R$-module (so, essentially, $F\cong R$). In the case of, say, rings, $F=\mathbb Z [X]$. For $R$-algebras, $F=R[X]$, and so on.