Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
344 views

R Tutorial

This document provides an introduction to R programming language. It discusses that R is a free software environment for statistical analysis and graphics. It reviews the basic data types in R including numeric, character, vectors, matrices, logical, factors, lists and data frames. It also demonstrates how to input data using the read.table() function and how to create simple graphs. The document lists some useful R functions and provides references for additional R tutorials.

Uploaded by

Amira ELbaroudi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
344 views

R Tutorial

This document provides an introduction to R programming language. It discusses that R is a free software environment for statistical analysis and graphics. It reviews the basic data types in R including numeric, character, vectors, matrices, logical, factors, lists and data frames. It also demonstrates how to input data using the read.table() function and how to create simple graphs. The document lists some useful R functions and provides references for additional R tutorials.

Uploaded by

Amira ELbaroudi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

R Programming

Language
Quick Tutorial

Agenda

Introduction
Data Types
Free Format Input
Simple Graphs

Agenda

Introduction
Data Types
Free Format Input
Simple Graphs

What is R
R is a free software programming language and
software environment for statistical computing
and graphics. (Wikipedia)

Download R
R is available for Windows, Linux and MacOS
Download it from:
http://www.r-project.org/

What R does and What it doesnt


Data handling and storage:
numeric, textual;
Matrix algebra;
Hash tables and regular
expressions;
High-level data analytic and
statistical functions
Classes (OO);
Graphics;
Programming language:
loops, branching, subroutines

Is not a database, but


connects to DBMSs;
Has no graphical user
interfaces, but connects to
Java, TclTk;
Language interpreter can be
very slow, but allows to call
own C/C++ code;
No spreadsheet view of data,
but connects to
Excel/MsOffice;
No commercial support

Agenda

Introduction
Data Types
Free Format Input
Simple Graphs

Data Types
Numeric:

Data Types (cont.)


Strings (character):

Data Types (cont.)


Vectors:

Data Types (cont.)


Matrices

Data Types (cont.)


Logical:

Data Types (cont.)


Factors:

Data Types (cont.)


Lists:

Data Types (cont.)


Data Frames:

Agenda

Introduction
Data Types
Free Format Input
Simple Graphs

Free Format Input


The function used to read data frames is
called: read.table()
R can read directly from the web. So, you
can specify the url of the dataset as input
Alternatively, you can specify the path to the
local file on your machine

Free Format Input

Agenda

Introduction
Data Types
Free Format Input
Simple Graphs

Simple Graphs

Useful Function
q(): quit R
getwd(), setwd(): get and set working
directory
help(functionName) or ?functionName
mean(), var(), cov(), cor(), summary() .. etc
Note: R depends on functions rather than
commands. So, the use of parenthesis is
crucial!

References

http://data.princeton.edu/R/introducingR.pdf
http://www.cyclismo.org/tutorial/R/index.html
http://www.statmethods.net/index.html
www.math.ntu.edu.
tw/~hchen/Prediction/notes/R-programming.ppt
http://en.wikipedia.org/wiki/R_
(programming_language)

You might also like