2.
3 GETTING TO THE BASICS
Iwillf yoube are familiar with any programming languages, then you
able to comfortably get into its coding process as it is
comparable to most of the structured programming
languages out there. But if you are new to programming or
haven’t learning any of it, do not worry as R is was built to
allow none coders to get the
ow of the process in no
time.
We will start with the
basic syntax to get the feel
of R by using its own
environment (R Console).
As of the time of this
writing, the current version
of R is version 4.4.1 code
name “Race for your Life”.
We will concentrate on
the console interface and its basic syntax for now. Just don’t
pay attention on the other features within the console itself as
you will be able to use these functions later on when you
gained a better understanding on its basic concepts and
implementation.
You can start the R Console when you “double-click” its
application icon or you can run the R interpreter directly in
your default Terminal (Linux or Mac) or Command Line
Application (Windows) of your computer’s Operating System
by tying R <enter> on command prompt as shown below. The
main di erence between running the R Console as a stand-
Page 33 of 77
fl
ff
alone are the additional features that are readily available in
the Console application while in the Terminal, you will get
only the “text” interface.
Whichever you choose to run R from, you will still be
operating R in plain text. You should take note that R
Language was generally created to aid Statistical Calculations
primarily for Data Science, so basically, you will be learning
(writing, reading, interpreting and applying) mathematical
operations.
And the rst thing to take note in R is its prompt
designated by > (greater than symbol). Each command
entered after the prompt will be interpreted as a command or
an expression and will be processed by the application.
Page 34 of 77
fi
For you to get the basic concept let’s run a simple
function, the help function, a function that is often overlooked
when you get more conformable using R. To execute this
command, just type “help()” and press enter.
This will open up the help documentation for R which you
can scroll through using the arrow keys or your mouse wheel
and if you want to close this document, just press “Q” and it
will automatically quit and return to the R command prompt.
On the other hand, when using the R Console, executing
the help function will open a separate window to display the
documentation in a plain text format which looks better that
the what is presented in the Terminal application.
Congratulations! You just executed your very rst R command!
Now let’s begin your journey to leaning R Language!
Page 35 of 77
fi