Introduction To R
Introduction To R
Department of Statistics
University of Ibadan
February 6, 2023
When learning data science, many people struggle with choosing which
programming languages to learn. There are many programming languages
available for data science, like R, Python, SAS, Java, and more. There are
many data science software packages to learn, such as SPSS Statistics,
SAS, Minitab, Tableau, Power BI and more.
Starting R
• The beauty of R is that it is a shareware, so it is free to anyone (no
license fee) and available online.
• To obtain R from windows (or Mac). Go to the comprehensive R
Archive Network (CRAN) at http://www.r-project.org or
http://www.cran.r-project.org and you can immediately install it.
• Once you have installed R, there will be an icon on your desktop.
Double click it and R will start up. When you do, a window should
appear in your screen.
• The ”>” is a prompt symbol displayed by R. This is R’s way of telling
you that it’s ready for you to type a command.
Objects
• The entities that R creates and manipulates are known as objects.
• These may be variables, arrays of numbers, character strings,
functions or more general structures built from such components.
• R saves any object you create.
• To list the object you have created in a session use either of the
following commands: >object() or ls().
• To remove all the object in R type: >rm(list=ls(all=T).
• To remove a specified number of objects use: >rm(x,y), only object x
and y will be removed.
• To quit the R program use the close(X) button in the window or you
can use the command q().