You are on page 1of 6

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.

You might also like