First of all we need to install the essential tools. There are so many tutorials available to install the tools. The following below videos will help,
The above installation will provide ‘R console’ window (Figure 1). But there is a development environment available and its called ‘RStudio’. The RStudio can be downloaded from their website.
After you’ve installed the tools, launch R Studio (Figure 2).
We should write our R code in the editor and it’s in the top left corner. The rest of the buttons in the editor is straightforward. This editor is very useful it provides quick intellisense while writing the code and also if we need to install the packages we can use this editor to write code to install new packages.
Environment & History Tabs
These two tabs are located in top right corner.
The Environment allows us to see all the list of defined variables or the dataset. This tab is very useful because when we are manipulating the dataset with different variables it allows to keep track all the dataset in each stage. In our implementation flow in a needed situation we can go through the list and use the dataset rather than running the full program.
History helps to keep track all the executed commands in console. These information will be stored into a hidden folder ‘.Rhistory’
It’s a Read Evaluate Print Loop (REPL) for R language and it’s in left bottom corner. Using the REPL we can test our code snippets. To get familiar with R language this area is very useful and it provides intellisense too.
Helper & Visual Tabs
We can find 5 tabs in right bottom corner.
- The files tab is straightforward, it will show the folder tree structure of your current working folder.
- The plots tab is used to show the graphs when you execute visualization code.
- The package tab helps to install the needed packages for our logics. So that you don’t need to write code in console/editor to install the package.
- The help tab allows reading the R Language documents. So once you execute the helper command (eg: ?data.frame) it will automatically open the relevant documents in the tab.
- Viewer is a browser built-in RStudio. We can develop web app using R Language and launch it in locally.
Now that we have an idea about the IDE lets implement a small code. Write the following code in the editor panel Highlight the code snippet and press ‘Run’ button in editor panel or mac users press ‘Command + Enter’ (Keyboard Shortcuts).