0% found this document useful (0 votes)
69 views7 pages

A Brief Introduction To R

R is a programming language and software environment for statistical computing and graphics. The R language has become a standard among statisticians for developing statistical software, and R is widely used for statistical software development and data analysis. R is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme. R is developed by the R Development Core Team, of which Chambers is a member. R is named partly after the first names of the first two R authors (Robert Gentleman and Ross Ihaka), and partly as a play on the name of S.

Uploaded by

Wong Wai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views7 pages

A Brief Introduction To R

R is a programming language and software environment for statistical computing and graphics. The R language has become a standard among statisticians for developing statistical software, and R is widely used for statistical software development and data analysis. R is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme. R is developed by the R Development Core Team, of which Chambers is a member. R is named partly after the first names of the first two R authors (Robert Gentleman and Ross Ihaka), and partly as a play on the name of S.

Uploaded by

Wong Wai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

A Brief Introduction to R

R is a programming language and software environment for statistical computing and


graphics. The R language has become a standard among statisticians for developing statistical
software, and R is widely used for statistical software development and data analysis. R is an
implementation of the S programming language combined with lexical scoping semantics inspired
by Scheme. R is developed by the R Development Core Team, of which Chambers is a member. R
is named partly after the first names of the first two R authors (Robert Gentleman and Ross Ihaka),
and partly as a play on the name of S.
R provides a wide variety of statistical and graphical techniques, including linear and nonlinear
modeling, classical statistical tests, time-series analysis, classification, clustering, and others. R is
easily extensible through functions and extensions, and the R community is noted for its active
contributions in terms of packages. There are some important differences, but much code written
for S runs unaltered. Many of R's standard functions are written in R itself, which makes it easy
for users to follow the algorithmic choices made. For computationally intensive tasks, C, C++, and
Fortran code can be linked and called at run time. Advanced users can write C or Java code to
manipulate R objects directly. (From Wikipedia)

The R project web page


http://www.r-project.org
is the main site for information on R. At this site are directions for obtaining the software,
accompanying packages and other sources of documentation.

Starting R
Download R from the above web site, and install it, press the icon for R on your desktop.

Install packages you need.

Data is a vector
For example, input 10 students marks
mark <- c(72,38,43,81,79,71,65,59,90,83)

Basic R commands

Statistical Commands

Graphics

Write your own functions and explore more

Introduction to MATLAB
MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation
programming language. Developed by MathWorks, MATLAB allows matrix manipulations,
plotting of functions and data, implementation of algorithms, creation of user interfaces, and
interfacing with programs written in other languages, including C, C++, Java, and Fortran.

Multi-platforms (Windows, Linux, MacOSX)


Technical computing
Script language
Variables are all matrices
Expandable by adding toolboxes

Entering matrix
>> A = [1, 2, 3; 4, 5, 6; 7 8 9]
>> B = eye(3)
Matrix function and manipulation

ones(3), zeros(3), eye(3)


magic(4), hilb(5), rand(4,3)
size(A), eig(A), det(A), inv(A), diag(A)
sum(A), prod(A), mean(A), max(A), std(A)

Additions (+)
Subtraction (-)
Multiplication (*)
Right division (/)

MATLAB graphics
If y is a vector, plot(y) produced a linear graph
plot(x,y) produces a graph of y versus x
t = 0: pi/10: 2*pi;
x = sin(t)
y1 = sin(t+.25);
y2 = sin(t+.50);
plot(x,y1,r-,x,y2,g--)
title(Phase Shift)
xlabel(x=sin(t));
ylabel(y1=sin(t+));

MATLAB graphics 3D mesh


x = [-pi:0.1:pi]; y=x;
[X,Y]=meshgrid(x,y);
Z = sin(X).* sin(Y) + cos(X).*cos(Y);
mesh(Z);

MATLAB programming and more

You might also like