0% found this document useful (0 votes)
63 views19 pages

R Presentation

The document discusses key aspects of how the R programming language works. It notes that R is an interpreted language where commands are directly executed without needing to build a complete program. It also highlights that R's syntax is simple, for example allowing linear regression to be performed with one command. The document then provides further details on R's use of objects in memory, functions, packages, and other terminologies used in R like variables, data types, operations, loops, strings, and functions.

Uploaded by

Faraz Shakir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views19 pages

R Presentation

The document discusses key aspects of how the R programming language works. It notes that R is an interpreted language where commands are directly executed without needing to build a complete program. It also highlights that R's syntax is simple, for example allowing linear regression to be performed with one command. The document then provides further details on R's use of objects in memory, functions, packages, and other terminologies used in R like variables, data types, operations, loops, strings, and functions.

Uploaded by

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

The fact that R is a language

may deter some users who


think “I can’t program”. This
should not be the case for
two reasons.
 FIRST
R is an interpreted
How R works language, not a compiled
one, meaning that all
commands typed on the
keyboard are directly
executed without requiring
to build a complete
program like in most
computer languages such
as (C, Fortran, Pascal, . . .)
 SECOND
R’s syntax is very simple and intuitive. For instance, a linear regression can be done with the
command lm(y ~ x) which means “fitting a linear model with y as response and x as
predictor”.

 In R, in order to be executed, a function always needs to be written with parentheses, even


if there is nothing within them (e.g., ls()). If one just types the name of a function without
parentheses, R will display the content of the function.
 While R is running, it’s
components such as
variables, data,
functions, results, etc.,
are stored in the active
memory of the computer
in the form of objects
which have a name. The
user can do actions on
these objects with
operators (arithmetic,
logical,comparison, . . . )
and functions (which are
themselves objects).
The arguments can be objects (\data", formulae, expressions, . . . ), some of which
could be defined by default in the function; these default values may be modified by
the user by specifying options. An R function may require no argument: either all
arguments are defined by default (and their values can be modified with the
options), or no argument has been defined in the function.

All the actions of R are done on objects stored in the active memory of the computer:
no temporary files are used. The readings and writings of files are used for input and
output of data and results (graphics, . . . ). The user executes the functions via some
commands. The results are displayed directly on the screen, stored in an object, or
written on the disk. Since the results are themselves objects, they can be considered
as data and analyzed as such. Data files can be read from the local disk or from a
remote server through internet.
1) All the functions which are available to users are stored in a
localised in a directory. This is the location where R is
installed such as (C:\Program Files\R\R-3.6.1\library).

2) This Directory stores various packages of functions, which are


already structured in directories.

3) A package named as “BASE” is the core of R and it contains


all basic functions of R.

4)All the packages have a directory named R with the file name
similar to package.

5) For Example: for base package, the name of the file will be
(C:\Program Files\R\R-3.6.1\library\base\R).

6) This file stores each and every function of the package.


 Let’s test a simple command by
typing the name of an object
for displaying its content. For
Example, If an object m
contains the value of 5.
 The digit ‘1’ inside the square
bracket indicates that index
will start at the very first
element. Basically indexing will
start at the very first element of
m.
 This command is similar to the
print function print(m). In some
situations, print function should
be used explicitly, such as
within a loop or function.
 The name of an object must
start with a letter (A-Z and a-z)
and can include letters, digits
(0-9), dots (.), and underscores
( ).
 R is a case-sensitive language,
thus it distinguishes lowercase
letters with the uppercase ones.
For example, H and h will be
considered as two different
objects in R.
1. • EXTREMELY COMPREHENSIVE

• RELATABLE TO OTHER
FEATURES 2.
PROGRAMMING LANGUAGE

OF “R”
3. • SUPPORTS EXTENSION

4. • CROSS - PLATFORM COMPATIBLE

5. • USER DEFINED FUNCTION


 R is extremely comprehensive
R offers more than 10000 packages from different stores in fields such as, data
mining,bio informatics, and spatial investigation. R can easily make projects of
Infinite size and non-uniform dataset. R offers a wide variety of capacities in
characterisation, graphical strategies and bunching.

 R easily relates to other programming languages


R has been integrated to many applications, databases, and record
framework. Due to this, R can identify with other languages efficiently. Likewise,
R can easily bring informayion from MySQL, Excel, Access, Oracle. It can be
effective in collecting information from different database utilising
ODBC(Open Database Connectivity Protocol) and Roracle package.
 R supports extensions
R is very extensible in nature. The information structure in R consists of grids,
records, scalars, vectors, time arrangements. R offers network math, OOP
concepts, and frameworks such as, geo-spatial directions and regression models.
Moreover, developers can add new capabilities and can customise the
methodologies.

 R is cross-platform compatible
One of the biggest point of interest in R is that we can use it on few working
frameworks and fluctuated hardware or software. We can use R language on any
operating system, be it Windows, Linux, or Macintosh. This compatibility makes R
more popular than its counterparts.

 R supports user defined functions


One of the most unique features of the R is that it allows users to add functions
written by the users themselves. Infact, most of the functions of R are user defined
functions. The structure of a user defined function is given below:

myfunction<-function(arg1,arg2, ..){
statements
return(object)
}
Variables

Data Types

Operations
Terminologies
used in R Loops

String

Functions
Functions
A function, in a programming environment, is a set of instructions. A
programmer builds a function to avoid repeating the same task, or
reduce complexity.
A function should be written to carry out a specified a tasks
may or may not include arguments
contain a body

may or may not return one or more values .


T • Built –in-function
Y • Math function
P • General Function
E • Statistical Function
S
TYPES OF FUNCTION
GENERAL FUNCTION
 diff() function
We can build a random time-series data with
a trend and then use the function diff() to
stationary the series. The diff() function
accepts one argument, a vector, and return
suitable lagged and iterated difference.

length() function
In many cases, we want to know the length of
a vector for computation or to be used in a
for loop. The length() function counts the
number of rows in vector x
2. Math Function
3.Statistical Functions
STRING
Any value coded within a pair of single quote (' ') and double quotes (" ") in R
programming is termed as a 'string'. On the inside, R stores all the strings within
double quotes, even if you use single quotes to create them.

LOOPS
Loops are used to execute multiple statements by using one or more
conditions. It saves the time as the user doesn’t need to input the same
conditions multiple times.

VARIABLES
A variable provides us with named storage that our programs can manipulate.
A variable in R can store an atomic vector, group of atomic vectors or a
combination of many R objects. A valid variable name consists of letters,
numbers and the dot or underline characters. The variable name starts with a
letter or the dot not followed by a number.
OPERATIONS
R Programming works with numerous
data types, including:

Scalars
Vectors (numerical, character, logical) Data Types
Matrices
Data frames
Lists

You might also like