# L3_R - ECEN 689 Statistical Computation in GSP...

This preview shows pages 1–11. Sign up to view the full content.

ECEN 689 Statistical Computation in GSP http://www.ece.tamu.edu/~ulisses/ECEN689/ Lecture 3: Introduction to R and Bioconductor Ulisses Braga-Neto Genomic Signal Processing Laboratory Department of Electrical and Computer Engineering Texas A&M University

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
The R Statistical Software "R is a statistical computer program, made available through the Internet under the General Public License (GPL), for Microsoft Windows 95 or later, for a variety of Unix and Linux platforms, and for the Apple Macintosh (OS versions newer than 8.6). R provides an environment in which you can perform statistical analysis and produce graphics." (P. Dalgaard, Introductory Statistics with R)
Brief History R evolved from the quite popular S-plus commercial statistical software. The first version of R was created by Ross Ihaka and Robert Gentleman from the University of Auckland, New Zealand, as a "reduced S" for teaching. They named it "R" because it was the letter before "S" (or was it their initials?) In any case, R was soon after released under the GPL and benefited from the explosion of open-source software in the mid-1990's. It has a large community of users who exchange ideas on open forums and contribute their own code in the form of R packages .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
R Installation • Go to: http://www.r-project.org • Click on "download R" • Select one of the U.S. CRAN mirrors, e.g.: http://cran.stat.ucla.edu • Click on "Windows" then "base" then "Download R 2.9.2 for Windows" • Save file to "Documents" folder, click and follow instructions (accept defaults).
Interactive Console • A typical R session consists of typed-in commands, line by line, and responses from the system after each line: > 2+2 [1] 4 > x <- exp(1) > x [1] 2.718282

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Vectors • R is an objected-oriented language. Every variable in R is an object. • The most used objects are numeric vectors . > weight <- c(60, 72, 57, 90, 95, 72) > weight [1] 60 72 57 90 95 72
Other kinds of Vectors Character vectors > patient.names <- c("John", "Paul", "Mary", "Tom", "Alice", "Nancy") > names(weight) <- patient.names > weight John Paul Mary Tom Alice Nancy 60 72 57 90 95 72 Logical vectors > weight>70 John Paul Mary Tom Alice Nancy FALSE TRUE FALSE TRUE TRUE TRUE

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Vectorized Arithmetic • When arithmetic operations are applied to vectors, they are performed element by element, producing another vector. > height <- c(1.75, 1.80, 1.65, 1.90, 1.74, 1.91) > bmi <- weight/height^2 > bmi John Paul Mary Tom Alice Nancy 19.591 22.222 20.936 24.930 31.377 19.736
Subsetting • Subsetting a vector is done with "[ ]" > weight[1] John 60 > weight[c(1,2,3)] John Paul Mary 60 72 57 > weight[2:5] Paul Mary Tom Alice 72 57 90 95 > weight[-1] ?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Conditional Selection • One can subset using relational operators
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/08/2010 for the course ECEN 689-601 taught by Professor Staff during the Spring '10 term at Texas A&M.

### Page1 / 39

L3_R - ECEN 689 Statistical Computation in GSP...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online