To program with R, we can use any text editor and a simple command-line interface. Both of these tools are already present on any operating system, so if you don't want to install anything more, you will be able to ignore this step.
Some find it more convenient to use an Integrated Development Environment (IDE); in this case, as there are several available, both free and paid, you'll be spoilt for choice. Having to make a choice, I prefer the RStudio environment.
RStudio is a set of integrated tools designed to help you be more productive with R. It includes a console, syntax-highlighting editor that supports direct code execution, and a variety of robust tools for plotting, viewing history, debugging, and managing your workspace.
RStudio is available at the following URL: https://www.rstudio.com/.
In the following screenshot you will see the main page of the RStudio website:
This is a popular IDE available in the open source, free, and commercial versions, which works on most operating systems. RStudio is probably the only development environment developed specifically for R. It is available for all major platforms (Windows, Linux, and macOS X) and can run on a local machine such as our computer or even on the web using RStudio Server. With RStudio Server, you can provide a browser-based interface (the so-called IDE) to an R version running on a remote Linux server. It integrates several features that are really useful, especially if you use R for more complex projects or if you want to have more than one developer on a project.
The environment is made up of four different areas:
- Scripting area: In this area we can open, create, and write our scripts
- Console area: This zone is the actual R console where commands are executed
- Workspace History area: In this area you can find a list of all the objects created in the workspace where we are working
- Visualization area: In this area we can easily load packages and open R help files, but more importantly, we can view charts
The following screenshot shows the RStudio environment:
With the use of RStudio, our work will be considerably simplified, displaying all the resources needed in one window.