Experiment OEC
Experiment OEC
Experiment -I
5. Click on the file containing the latest version ofR under "Files."
To Install RStudio
3. Click on the version recommended for yoursystem, or the latest Mac version,save the
.dmg file on your computer, double-click it to open, and then drag and drop it to your
applicationsfolder.
To Install R Packages
The capabilities of R are extended through user-created packages, which allow specialized
Sweave), etc. These packages are developedprimarilyinR, and sometimesin Java,C,C++, and
research data, code and reportfilesin a systematic way forsharing and public archiving.
A core set of packages is included with the installation of R, with more than 12,500 additional
(CRAN).
Packages are collections of Rfunctions,data, and compiled codein a well- defined format. The
directory where packages are stored is called the library.R comes with a standard set of
packages. Others are available for download and installation.Once installed, they have to be
Adding R Packages
You can expand the types of analyses you do be addingother packages. A complete list of
R PROGRAMMING
1. Download and install a package (you only need to do this once).To use the package,
invoke the library(package) command to load it into the current session. (You need
It turns out the ability to estimate ordered logistic or probit regression is included in the
MASS package.
packages(" MASS")
You will be asked to pick a CRAN mirror from which to download (generally the closer
the faster) and R will install the package to your library.R willstill be clueless. To actually
tell Rto use the new package you have to tell R to load the package’s library each time you
>
R nowknowsall the functionsthat are canned in the MASSpackage. To see what functions
>
The Workspace
The workspace is your current R working environment and includes any user-definedobjects
image of the current workspace that is automatically reloaded the next time R is started.
Commands are entered interactively at the R user prompt. Up and down arrow keys scroll
You will probably want to keep differentprojects in differentphysical directories. Here are
R PROGRAMMING
settings
Aim:
Objective:
DATA TYPES
You may like to store information of various data typeslike character, wide character, integer,
operating system allocates memory and decides what can be stored in the reservedmemory.
The variables are assigned with R-Objects and the data type of the R-object becomes the data type of
the variable. There are many types of R-objects. The frequently used ones are −
• Factors: Factors are the r-objects which are created using a vector. It storesthe vector
along with the distinct values of the elements in the vector as labels. The labels are
• Data Frames: Data frames are tabular data objects. Unlike a matrix in data frame each
column can contain different modes of data. The first column can be numeric while the
second column can be character and third column can be logical. It is a list of vectors of
equal length.
• Lists:A list is an R-object which can contain many different types of elements inside it