Вы находитесь на странице: 1из 3

SESSION 2

GETTING ACQUAINTED WITH THE PLATFORM R – A BRIEF


SUMMARY

Installation:

Install R console and then R studio to avoid compatibility issues.

R Studio:

RStudio is an Integrated Development Environment (IDE) that helps you develop programs in R.
In other words, R studio is a platform to use the programming language R. R studio has 4 major
windows as given below

Window 1

Window 1 is called the Console and is considered the mother of R studio. An R console is a pane
in a window in which a user can type R commands, submit them for execution, and view the
results.
Window 2

Window 2 is the workspace where you can type the code and run the code. Please note that every
line should be executed separately. The execution, progress, errors and output will be shown in
the console.

Window 3

Window 3 contains all the variables that are declared. It contains the data sets that are extracted.
You can also import data sets straight away if they are of the type .xls,.csv, .txt. Data from SPSS,
SAS and Stata can also be imported directly.

Window 4

Window 4 contains files present in the directory, the packages that are installed, plots (if your
code has them), and help tab

Directory:

By default, C:/Programs/R is set as the directory. However, it is advised to change the directory
in order to avoid losing the data. This can be done by Session (in the menu bar) -> set working
directory

It can also be done using the command -> setwd("D:/R working Directory")

Packages

R packages are a collection of R functions, complied code and sample data. They are stored unde
r a directory called "library" in the R environment. By default, R installs a set of packages during
installation. More packages are added later, when they are needed for some specific purposes.
Packages can be installed from the window 4 by clicking on Install packages under the packages
tab.

It can also be done using the command <- install.packages("readxl")


In order to load the package into your woring directory, the command “library(readxl)” should b
e used.

Reading a file

To read a excel file, read_excel("D:/class notes and ppt/Term 5/BAR/Concrete_Data.xls", sheet=


"Sheet1") should be used
To read a csv , read.csv("D:/class notes and ppt/Term 5/BAR/groceries-apriori.csv") should be us
ed.

However, these are not the only methods.

Вам также может понравиться