R Programming Development Environment

R Programming Development Environment

R provides us with a command line interface where we can write all our required commands. In this post we will learn some basic commands to:

R Command Line

R provides us with a command line interface where we can write all our required commands. In this post we will learn some basic commands to:

1. Getting help

We can use the help() for the topic we want to search.

> help(Syntax)

Alternatively, we can use

> ?Syntax

Searching for specific topics in help

> help.search(“SearchText”)

> ??“SearchText”

2. Executing Scripts

Running script from an external file. This will run the file present in the specified path. Either you provide the full path, that is, “c:\………file.R” or your file.R should be in the same directory.

> source(“file.R”)

> source(“c:\…….\file.R”)

3. HTML based starting document

This will give you a HTML based document to get you up and running.

> help.start()


4. Demo

Demonstrations provided with the package to illustrate some basic methods. This will show all the available demos.

> demo(package = .packages(all.available = TRUE))

This will run the demo. You can toggle pausing between pages to true and false.

> demo(lm.glm, package = “stats”, ask = TRUE)

> demo(lm.glm, package = “stats”, ask = FALSE)

5. Quit

Stop the execution with this anytime

> q()

Integrated Development Environment

R provides us with a GUI but that is not very developer friendly and visually appealing. There are many IDE’s available for R, RStudio being best of them. You can download any IDE you prefer, but in these blog posts we will be using RStudio. It is cross-platform and open-source. You can even run it on remote servers.

It’s available for Windows, Mac and Linux from https://www.rstudio.com/

After successful installation RStusio will look like this,

RStusio

Top-left: R Scripts
Bottom-left: R command line
Top-right: Environment and History
Bottom-right: Files, Plots and Packages