0% found this document useful (0 votes)
37 views

Experiment No.2: AIM:Introduction and Implementation of R-Language

R is a programming language and free software environment for statistical computing and graphics. It implements a wide variety of statistical and graphical techniques and is easily extensible through functions and extensions. Variables, vectors, lists, matrices and different operators can be used in R. Functions are sets of instructions to perform repetitive tasks or reduce complexity. There are built-in functions like general, math, and statistical functions as well as user-defined functions that are written by the user.

Uploaded by

Seth Rollins
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Experiment No.2: AIM:Introduction and Implementation of R-Language

R is a programming language and free software environment for statistical computing and graphics. It implements a wide variety of statistical and graphical techniques and is easily extensible through functions and extensions. Variables, vectors, lists, matrices and different operators can be used in R. Functions are sets of instructions to perform repetitive tasks or reduce complexity. There are built-in functions like general, math, and statistical functions as well as user-defined functions that are written by the user.

Uploaded by

Seth Rollins
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

EXPERIMENT NO.

AIM:Introduction and implementation of R-Language

2.1 Introduction: R is a programming language and free software environment


for statistical computing and graphics supported by R foundation for statistical
computing .It is widely used among statisticians and data miners for developing
statistical software and data analysis polls.

2.2 Features:
1. R language and its libraries implement wide variety of statistical and graphical
techniques
2. It is easily extensible through functions and extensions.
3. R community is noted for its active contributions in terms of packages.
4. R is static graphics.
5. R has rd, its own LaTeX -like documentation format.

2.3 implementation:

1) Variable: Variable is any value whose value is not fixed.In r language there is no
need to write data type of variable. It can assign value either using arrow <- or
using assignment character = .
Syntax: variable<- value assign or variable =value assign
Example:x<-5

2) Vectors: It is simplest data structure in r language. A vector is a sequence of data


elements of same basic type.
Syntax:V1<-c(components)
Example:V1<-c(2,3,5)
3. List:It is the object which contain elements of different type- like
strings,numbers,vectors.It also contain matrix or a function.
Syntax:l1<-list(components)
Example:l1<-list(2,2.4,3.5)

4. Operators: R language has mainly 4 categories of operators in R programming


language
1) Arithmetic operators:+,-,*,/,^,%%
2) Relational operator: <,>,==,<=,>=,!=
3) Logical operator: &,|,1,&&,||
4) Assignment operator:=,<-,->,<<-,->>

5) Matrices:Matrices are the R objects in which the elements are arranged in 2-


rectangular layout. They are similar to vector but they additionally contain the
dimension attribute.
Syntax: m1<-matrix(range,no. of rows,no. of columns,Byrow=True/False)
Example:matrix(1:6,2,3,Byrow=true)

2.4 functions in R- language: A function in R programming environment,is set


of instructions.A programmer builds a function to avoid same repeating text or
reducing complexity.
1) Built in functions: there are mainly 3 kinds of built in functions.
A. General functions
B. Maths function
C. Statistical function
2) User Define functions: functions written by user is known as user defined
function.It involves name,arguments and a body.
Syntax:Function name<-function(arguments)
{
Computations on the arguments
Some other code
}
Call a function:Function name(parameters)
Example: Evaluate the power of any number
Solution: abc<-function(x,y)
{
x<-x^y
}
Call abc function:abc(5,2)
Output:25

You might also like