R Studio Tutorial

R Studio Tutorial

  • R
  • 4 mins read

In this article, we will learn how to set up an IDE (R Studio) for R and use it to create basic to complex R programs with ease. To learn how to install R, please check our R installation article.

An Integrated Development Environment (IDE), as the name suggests, is a collection of numerous utilities under one single umbrella. All IDEs are inclusive of the basic GUI features; that is, a text editor as well as a console window screen to display the snippets that are being executed. IDEs contain file managers, debuggers, and various packages to visualize and analyze the data. The utilities don’t have to be explicitly installed on the system. 

It can be basically considered as a software application that provides integration of multiple developer tools under one graphical window. Another advantage of using IDEs is the vast range of features that they come up with; for instance, the automatic code completion and error handling mechanisms. Thereby, the speed of execution is increased manifold. 

R Studio 

One of the most popular IDE for the development of R programming is R Studio. RStudio is an open source software that provides a unified setup inclusive of the editor, console screen, varied tools to understand visualizations and data analysis, syntax highlight feature, and packages to perform enhancements on the available input data. 

R studio is available for all types of environments and can be easily downloaded from the following URL, https://www.rstudio.com/products/rstudio/download/. The version and the environment type can be chosen from the website to begin the download process. The installation wizard will pop up indicating the steps required to complete the installation. 

For instance, in the case of macOS systems, the following option will be available.

R download options for macOS.

There are two versions of the R Studio software that are available, Desktop and Server. R Studio Desktop is basically a standalone application with no other dependencies for code execution. R Studio servers, on the other hand, is a kind of Linux application developed to facilitate web-browser interfaces. 

R Studio interface can then be started after its successful installation. The basic interface consists of an editor part that contains the code lines and a corresponding console screen which displays the output of the code executed. Other utilities like the file manager indicative of the files available within the current directory, the plots, and the packages panel are also present, as indicated in the diagram. They are used to install the packages required for data manipulation and handling as well as visualize the plots in a user-friendly manner. The environments tab on the top right is also used to keep a track of the variables that are used temporarily. 

R Studio editor.

By unifying all the tabs under one window, the user is able to get an interactive view of the way variables to interact with objects, the visibility of the variables involved in the execution as well as the various files stored within the directory. Therefore, it reduces the hassle of code handling and facilitates regressive iterations in code development. 

Creating a new project in R Studio

 A new project can be created in R Studio by simply clicking on the option “Create a new project”. 

Successively, choose the option “New Directory” followed by the option “New Project”. The user will be prompted to choose the project name, which is assigned as the directory name. The location can be specified based on the user’s choice. 

A screen pops up containing all the components required for running R programs. Users can now start with basic R programs to begin development. 

In the following snapshot, a basic string printing code line is executed. 

print("Hello")

[1] "Hello"

Editing program in R studio.