You can obtain the R binary distributions for Windows, Linux, and Mac from here.
You can use a code editor or IDE (Integrate Development Environment) instead of directly entering commands in R console or simple text editors. These code editors allow syntax highlighting of R language which makes it easier to write/read codes. I highly recommend a new IDE, RStudio which combines an intuitive user interface with powerful coding tools, available for all major platforms!
After installing R, you can install RStudio from here.
By going to File > New > R Script, you can open an script in which you can write your code (You can directly enter your commands in Console, but entering them in script file let you save, re-execute, edit and change them whenever you like!).