R Programming

What is R Programing

R is a programming language and software environment for statistical analysis, graphics representation and reporting. R was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is currently developed by the R Development Core Team.

The core of R is an interpreted computer language which allows branching and looping as well as modular programming using functions. R allows integration with the procedures written in the C, C++, .Net, Python or FORTRAN languages for efficiency.

R is open source distributed by GNU,is widely used for statistical programming,Business intelligence,graphical presentation and reporting.it is #1 choice for data Scientist for data analyst and representation.Also R is good for Statistical calculation  on arrays, lists, vectors and matrices.A tool for DATA analysis.

Local Environment Setup

R can be install on Window and Linux.

Window Environment : https://cran.r-project.org/bin/windows/base

Linux Installation :https://cran.r-project.org/bin/linux/

Type ‘demo()’ for some demos, ‘help()’ for on-line help, or
‘help.start()’ for an HTML browser interface to help.
Type ‘q()’ to quit R.

at R prompt to install the required package. For example, the following command will install plotrix package which is required for 3D charts.

> install.packages("plotrix")

R Command Prompt

When local Environment is set up then you can start using R by typing this command

$ R , this will launch R interpreter with > prompt’… then you can type your command.

> myString <- "Hello, World!"
> print ( myString)
[1] "Hello, World!"                                                                   

first statement defines a string variable myString, where we assign (<-) a string “Hello, World!” and then next statement print() is being used to print the value stored in variable myString

R Script File
Mostly R program is written in Scripfile then execute it at the Window or LInux command prompt
by R interpreter called Rscript.

Let write a Scriptfile
# My program in R Programming
myString <- “Hello, World!”
print ( myString)

Save the above code in a file hello.R and execute it,
execute it at Window command prompt

$ Rscript hello.R

it produces the following result.

[1] “Hello, World!”

Comments are like helping text in your R program and will be ignored by the interpreter while executing your program. Single comment is written using # in the beginning of the statement as follows

# My first program in R Programming

Next Blog will be about R Data Types
Vectors, Lists, Matrices, Arrays, Factors and Data Frames

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s