Basic R Part 1 BTI Plant Bioinformatics Course

Size: px
Start display at page:

Download "Basic R Part 1 BTI Plant Bioinformatics Course"

Transcription

1 Basic R Part 1 BTI Plant Bioinformatics Course Spring 2013 Sol Genomics Network Boyce Thompson Institute for Plant Research by Jeremy D. Edwards

2 What is R? Statistical programming language Derived from S Developed at Bell Labs (also developed C programming language and UNIX)

3 Why use R? R is Free Software : Think 'free' as in 'free speech' not as in 'free beer' (it's actually both) Free to install anywhere Scripting Reproducibility Contributions from the scientific community Publication-quality plots

4 How to run R Type R Linux terminal: use via SSH, use pipes, etc. One line at a time or run scripts GUI RStudio R Commander

5 How to quit R Type quit() or q() Saving your workspace > q() Save workspace image? [y/n/c]:

6 How to get help in R help() for general help help(topic) or?topic where topic is a specific topic, e.g., help(q) help.search( topic ) or??topic for help finding pages on a vague topic, e.g.,??quit help.start() launch HTML help page library(help="package") Get help for a specific package, e,g., library(help= base ) for help on base package

7 Comment lines in R R interprets anything following the # character to the end of the line as a comment Works the same way in the Linux command line Useful to document code Useful to temporarily remove lines from a script (i.e., comment out) > #comment line example > help(q) #get help

8 R basic operations: computation > [1] 2 Try: 2 * 2 4 ^ 2 abs (-1) Result log (10) sqrt (4) pi

9 R basic operations: assignment operator assignment operator > x < > x [1] 2 Using <- is considered better style than using = In function calls, using = will declare the variable only within the scope of the function, and <- will declare it for the user workspace.

10 Vectors Create a vector combine > x <- c(2,4,6,8) [1] Create a vector of consecutive integers > y <- 1:4 [1]

11 Character vectors Create a vector of character strings > colors <- c("red","green","blue") > colors [1] "red" "green" "blue"

12 > x [1] Logical vectors >#elements in x less than 5 > z <- x<5 > z [1] TRUE TRUE FALSE FALSE >#numerical to logical > z <- as.logical(c(1,0,0,1)) > z [1] TRUE FALSE FALSE TRUE

13 > x [1] Vector operations > x + 1 #scalar addition [1] > x * 2 #scalar multiplication [1] > sum(x) #sum of elements [1] 20

14 Vectors: component extraction > x [1] > x[3] #third element of x [1] 6 > x[2:4] #second to fourth element of x [1] > x[-2] #all except the second element [1] > x[x>5] #elements of x greater than 5 [1] 6 8 > z #a logical vector [1] TRUE FALSE FALSE TRUE > x[z] #get elements with logical vector [1] 2 8

15 Vectors: naming components > colors [1] "red" "green" "blue" > wavelength <- c(650,510,475) > names(wavelength) <- colors #assign names > wavelength red green blue > wavelength[ green ] #component by name green 510

16 Arrays An array can be considered as a multiply subscripted collection of data entries The data vector contains the values in the array The dimension vector gives the dimensions of the array data vector dimension vector > x <- array( 1:20, c(4,5) ) > x [,1] [,2] [,3] [,4] [,5] [1,] [2,] [3,] [4,]

17 Arrays: component extraction > xyz <- array(c(1:27), dim=c(3, 3, 3)) > xyz[2,2,2] # a single numeric element [1] 14 > xyz[2,2, ] # a vector (1 dimension array) [1] > xyz[2,, ] # a 2 dimension array [,1] [,2] [,3] [1,] [2,] [3,]

18 Matrices A matrix is a two dimensional array > xy <- matrix(c(1:9), ncol=3, nrow=3) > xy [,1] [,2] [,3] [1,] [2,] [3,] 3 6 9

19 Matrices: index names Matrix indexes can be replaced with names > xy <- matrix(c(1:9), ncol=3, nrow=3, dimnames=list(c("a","b","c"), c("x", "y", "z"))) > xy x y z A B C 3 6 9

20 Creating matrices > xy <- matrix(c(1:9), ncol=3, nrow=3, dimnames=list(c("a","b","c"), c("x", "y", "z"))) > xy x y z A B C > x <- c(1,2,3); y <- c(4,5,6) > col_xy <- cbind(x, y) > row_xy <- rbind(x, y) > col_xy x y [1,] 1 4 [2,] 2 5 [3,] 3 6 > row_xy [,1] [,2] [,3] x y 4 5 6

21 Lists A list is an ordered collection of objects > c <- c("m82", "Alisa Craig", "Microtom") > y <- c(2006, 2008) > l <- c("ca", "FL") > s <- array(c(2, 1, 3, 4, 6, 2, 5, 7, 5, 6, 3, 2, 2), dim=c(3, 2, 2)) > phenom <- list(cultivars=c, years=y, localizations=l, size=s) > list

22 Lists: objects by name > phenom$cultivars [1] "M82" "Alisa Craig" "Microtom"

23 Data frames Data frames are a list with class "data.frame" with the following features: The components must be vectors (numeric, character, or logical), factors, numeric matrices, lists, or other data frames. Matrices, lists, and data frames provide as many variables to the new data frame as they have columns, elements, or variables, respectively. Numeric vectors, logicals and factors are included as is, and character vectors are coerced to be factors, whose levels are the unique values appearing in the vector. Vector structures appearing as variables of the data frame must all have the same length, and matrix structures must all have the same row size.

24 Data frames: example > accessions <- c("alisa Craig", "Black Cherry", "Comete", "Gnom") > fruit_size <- matrix(c(7, 8, 5, 7, 6, 8, 9, 8), ncol=2, nrow=4, byrow=true, dimnames=list(accessions, c(2006,2007))) > sugar_content <- matrix(c(2.1, 3.2, 3, 2.1, 4.1, 2.3, 2.8, 3.1), ncol=1, nrow=4, byrow=true, dimnames=list(accessions, c(2008))) > phenome <- data.frame(fruit_size, sugar_content) > phenome X2006 X2007 X2008 Alisa Craig Black Cherry Comete Gnom

25 Data frames: accessing data > phenome data.frame(fruit_size, sugar_content) # As a matrix: > phenome[1,] # for a row > phenome[,1] # for a column > phenome[1,1] # for a single data # Based in the column names > phenome$x2007 # To divide/join the data.frame in its columns use attach/detach function > attach(phenome) > X2007 >summary(phenome) #stats about this dataframe

26 Data frames: import and export data read.table()/write.table() > phenome read.table( example.data ); read.table() arguments: header=false/true, sep=, quote= \ '

27 Functions > do_some_stuff <-{ls; a<-100; a;} [1] 100

28 Packages Set of functions and data that can be downloaded and installed from R repository CRAN. Example: 'ade4', is a package of analysis of ecological Data. Important Commands: > install.packages( ade4 ) > library( ade4 ) > packagedescription( ade4 )

Basic R Part 1. Boyce Thompson Institute for Plant Research Tower Road Ithaca, New York U.S.A. by Aureliano Bombarely Gomez

Basic R Part 1. Boyce Thompson Institute for Plant Research Tower Road Ithaca, New York U.S.A. by Aureliano Bombarely Gomez Basic R Part 1 Boyce Thompson Institute for Plant Research Tower Road Ithaca, New York 14853-1801 U.S.A. by Aureliano Bombarely Gomez A Brief Introduction to R: 1. What is R? 2. Software and documentation.

More information

Stat 579: Objects in R Vectors

Stat 579: Objects in R Vectors Stat 579: Objects in R Vectors Ranjan Maitra 2220 Snedecor Hall Department of Statistics Iowa State University. Phone: 515-294-7757 maitra@iastate.edu, 1/23 Logical Vectors I R allows manipulation of logical

More information

Introduction to R Benedikt Brors Dept. Intelligent Bioinformatics Systems German Cancer Research Center

Introduction to R Benedikt Brors Dept. Intelligent Bioinformatics Systems German Cancer Research Center Introduction to R Benedikt Brors Dept. Intelligent Bioinformatics Systems German Cancer Research Center What is R? R is a statistical computing environment with graphics capabilites It is fully scriptable

More information

Lecture 1: Getting Started and Data Basics

Lecture 1: Getting Started and Data Basics Lecture 1: Getting Started and Data Basics The first lecture is intended to provide you the basics for running R. Outline: 1. An Introductory R Session 2. R as a Calculator 3. Import, export and manipulate

More information

STAT 571A Advanced Statistical Regression Analysis. Introduction to R NOTES

STAT 571A Advanced Statistical Regression Analysis. Introduction to R NOTES STAT 571A Advanced Statistical Regression Analysis Introduction to R NOTES 2015 University of Arizona Statistics GIDP. All rights reserved, except where previous rights exist. No part of this material

More information

MBV4410/9410 Fall Bioinformatics for Molecular Biology. Introduction to R

MBV4410/9410 Fall Bioinformatics for Molecular Biology. Introduction to R MBV4410/9410 Fall 2018 Bioinformatics for Molecular Biology Introduction to R Outline Introduce R Basic operations RStudio Bioconductor? Goal of the lecture Introduce you to R Show how to run R, basic

More information

R Short Course Session 1

R Short Course Session 1 R Short Course Session 1 Daniel Zhao, PhD Sixia Chen, PhD Department of Biostatistics and Epidemiology College of Public Health, OUHSC 10/23/2015 Outline Overview of the 5 sessions Pre-requisite requirements

More information

STAT 540 Computing in Statistics

STAT 540 Computing in Statistics STAT 540 Computing in Statistics Introduces programming skills in two important statistical computer languages/packages. 30-40% R and 60-70% SAS Examples of Programming Skills: 1. Importing Data from External

More information

STA 248 S: Some R Basics

STA 248 S: Some R Basics STA 248 S: Some R Basics The real basics The R prompt > > # A comment in R. Data To make the variable x equal to 2 use > x x = 2 To make x a vector, use the function c() ( c for concatenate)

More information

Functions and data structures. Programming in R for Data Science Anders Stockmarr, Kasper Kristensen, Anders Nielsen

Functions and data structures. Programming in R for Data Science Anders Stockmarr, Kasper Kristensen, Anders Nielsen Functions and data structures Programming in R for Data Science Anders Stockmarr, Kasper Kristensen, Anders Nielsen Objects of the game In R we have objects which are functions and objects which are data.

More information

EPIB Four Lecture Overview of R

EPIB Four Lecture Overview of R EPIB-613 - Four Lecture Overview of R R is a package with enormous capacity for complex statistical analysis. We will see only a small proportion of what it can do. The R component of EPIB-613 is divided

More information

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013 Lab of COMP 406 MATLAB: Quick Start Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 1: 11th Sep, 2013 1 Where is Matlab? Find the Matlab under the folder 1.

More information

Introduction to R: Using R for statistics and data analysis

Introduction to R: Using R for statistics and data analysis Why use R? Introduction to R: Using R for statistics and data analysis George W Bell, Ph.D. BaRC Hot Topics November 2014 Bioinformatics and Research Computing Whitehead Institute http://barc.wi.mit.edu/hot_topics/

More information

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors. 1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN

More information

Introduction to R: Using R for statistics and data analysis

Introduction to R: Using R for statistics and data analysis Why use R? Introduction to R: Using R for statistics and data analysis George W Bell, Ph.D. BaRC Hot Topics November 2015 Bioinformatics and Research Computing Whitehead Institute http://barc.wi.mit.edu/hot_topics/

More information

Mails : ; Document version: 14/09/12

Mails : ; Document version: 14/09/12 Mails : leslie.regad@univ-paris-diderot.fr ; gaelle.lelandais@univ-paris-diderot.fr Document version: 14/09/12 A freely available language and environment Statistical computing Graphics Supplementary

More information

Introduction to R. Stat Statistical Computing - Summer Dr. Junvie Pailden. July 5, Southern Illinois University Edwardsville

Introduction to R. Stat Statistical Computing - Summer Dr. Junvie Pailden. July 5, Southern Illinois University Edwardsville Introduction to R Stat 575 - Statistical Computing - Summer 2016 Dr. Junvie Pailden Southern Illinois University Edwardsville July 5, 2016 Why R R offers a powerful and appealing interactive environment

More information

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial 1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the

More information

Why use R? Getting started. Why not use R? Introduction to R: It s hard to use at first. To perform inferential statistics (e.g., use a statistical

Why use R? Getting started. Why not use R? Introduction to R: It s hard to use at first. To perform inferential statistics (e.g., use a statistical Why use R? Introduction to R: Using R for statistics ti ti and data analysis BaRC Hot Topics November 2013 George W. Bell, Ph.D. http://jura.wi.mit.edu/bio/education/hot_topics/ To perform inferential

More information

Package spark. July 21, 2017

Package spark. July 21, 2017 Title 'Sparklines' in the 'R' Terminal Version 2.0.0 Author Gábor Csárdi Package spark July 21, 2017 Maintainer Gábor Csárdi A 'sparkline' is a line chart, without axes and labels.

More information

Description/History Objects/Language Description Commonly Used Basic Functions. More Specific Functionality Further Resources

Description/History Objects/Language Description Commonly Used Basic Functions. More Specific Functionality Further Resources R Outline Description/History Objects/Language Description Commonly Used Basic Functions Basic Stats and distributions I/O Plotting Programming More Specific Functionality Further Resources www.r-project.org

More information

Introduction to R, Github and Gitlab

Introduction to R, Github and Gitlab Introduction to R, Github and Gitlab 27/11/2018 Pierpaolo Maisano Delser mail: maisanop@tcd.ie ; pm604@cam.ac.uk Outline: Why R? What can R do? Basic commands and operations Data analysis in R Github and

More information

Programming R. Manuel J. A. Eugster. Chapter 1: Basic Vocabulary. Last modification on April 11, 2012

Programming R. Manuel J. A. Eugster. Chapter 1: Basic Vocabulary. Last modification on April 11, 2012 Manuel J. A. Eugster Programming R Chapter 1: Basic Vocabulary Last modification on April 11, 2012 Draft of the R programming book I always wanted to read http://mjaeugster.github.com/progr Licensed under

More information

Extremely short introduction to R Jean-Yves Sgro Feb 20, 2018

Extremely short introduction to R Jean-Yves Sgro Feb 20, 2018 Extremely short introduction to R Jean-Yves Sgro Feb 20, 2018 Contents 1 Suggested ahead activities 1 2 Introduction to R 2 2.1 Learning Objectives......................................... 2 3 Starting

More information

ECE Lesson Plan - Class 1 Fall, 2001

ECE Lesson Plan - Class 1 Fall, 2001 ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not

More information

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window. EE 350L: Signals and Transforms Lab Spring 2007 Lab #1 - Introduction to MATLAB Lab Handout Matlab Software: Matlab will be the analytical tool used in the signals lab. The laboratory has network licenses

More information

Data types and structures

Data types and structures An introduc+on to Data types and structures Noémie Becker & Benedikt Holtmann Winter Semester 16/17 Course outline Day 3 Review GeFng started with R Crea+ng Objects Data types in R Data structures in R

More information

HERIOT-WATT UNIVERSITY DEPARTMENT OF COMPUTING AND ELECTRICAL ENGINEERING. B35SD2 Matlab tutorial 1 MATLAB BASICS

HERIOT-WATT UNIVERSITY DEPARTMENT OF COMPUTING AND ELECTRICAL ENGINEERING. B35SD2 Matlab tutorial 1 MATLAB BASICS HERIOT-WATT UNIVERSITY DEPARTMENT OF COMPUTING AND ELECTRICAL ENGINEERING Objectives: B35SD2 Matlab tutorial 1 MATLAB BASICS Matlab is a very powerful, high level language, It is also very easy to use.

More information

8.1 R Computational Toolbox Tutorial 3

8.1 R Computational Toolbox Tutorial 3 8.1 R Computational Toolbox Tutorial 3 Introduction to Computational Science: Modeling and Simulation for the Sciences, 2 nd Edition Angela B. Shiflet and George W. Shiflet Wofford College 2014 by Princeton

More information

Intro to R. Some history. Some history

Intro to R. Some history. Some history Intro to R Héctor Corrada Bravo CMSC858B Spring 2012 University of Maryland Computer Science http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?_r=2&pagewanted=1 http://www.forbes.com/forbes/2010/0524/opinions-software-norman-nie-spss-ideas-opinions.html

More information

Data Structures STAT 133. Gaston Sanchez. Department of Statistics, UC Berkeley

Data Structures STAT 133. Gaston Sanchez. Department of Statistics, UC Berkeley Data Structures STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 Data Types and Structures To make the

More information

Spatial Ecology Lab 2: Data Analysis with R

Spatial Ecology Lab 2: Data Analysis with R Spatial Ecology Lab 2: Data Analysis with R Damian Maddalena Spring 2015 1 Introduction This lab will get your started with basic data analysis in R. We will load a dataset, do some very basic data manipulations,

More information

Introduction to R: Data Types

Introduction to R: Data Types Introduction to R: Data Types https://ivanek.github.io/introductiontor/ Florian Geier (florian.geier@unibas.ch) September 26, 2018 Recapitulation Possible workspaces Install R & RStudio on your laptop

More information

The Beginning g of an Introduction to R Dan Nettleton

The Beginning g of an Introduction to R Dan Nettleton The Beginning g of an Introduction to R for New Users 2010 Dan Nettleton 1 Preliminaries Throughout these slides, red text indicates text that is typed at the R prompt or text that is to be cut from a

More information

Introduction to R. Daniel Berglund. 9 November 2017

Introduction to R. Daniel Berglund. 9 November 2017 Introduction to R Daniel Berglund 9 November 2017 1 / 15 R R is available at the KTH computers If you want to install it yourself it is available at https://cran.r-project.org/ Rstudio an IDE for R is

More information

MATLAB NOTES. Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional.

MATLAB NOTES. Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional. MATLAB NOTES Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional. Excellent graphics that are easy to use. Powerful interactive facilities; and programs

More information

Chapter 1 Introduction to MATLAB

Chapter 1 Introduction to MATLAB Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,

More information

Basic matrix math in R

Basic matrix math in R 1 Basic matrix math in R This chapter reviews the basic matrix math operations that you will need to understand the course material and how to do these operations in R. 1.1 Creating matrices in R Create

More information

1/22/2018. Multivariate Applications in Ecology (BSC 747) Ecological datasets are very often large and complex

1/22/2018. Multivariate Applications in Ecology (BSC 747) Ecological datasets are very often large and complex Multivariate Applications in Ecology (BSC 747) Ecological datasets are very often large and complex Modern integrative approaches have allowed for collection of more data, challenge is proper integration

More information

COMPUTER APPLICATION

COMPUTER APPLICATION Total No. of Printed Pages 16 HS/XII/A.Sc.Com/CAP/14 2 0 1 4 COMPUTER APPLICATION ( Science / Arts / Commerce ) ( Theory ) Full Marks : 70 Time : 3 hours The figures in the margin indicate full marks for

More information

Lab #10 Multi-dimensional Arrays

Lab #10 Multi-dimensional Arrays Multi-dimensional Arrays Sheet s Owner Student ID Name Signature Group partner 1. Two-Dimensional Arrays Arrays that we have seen and used so far are one dimensional arrays, where each element is indexed

More information

Introduction to R. Course in Practical Analysis of Microarray Data Computational Exercises

Introduction to R. Course in Practical Analysis of Microarray Data Computational Exercises Introduction to R Course in Practical Analysis of Microarray Data Computational Exercises 2010 March 22-26, Technischen Universität München Amin Moghaddasi, Kurt Fellenberg 1. Installing R. Check whether

More information

ITS Introduction to R course

ITS Introduction to R course ITS Introduction to R course Nov. 29, 2018 Using this document Code blocks and R code have a grey background (note, code nested in the text is not highlighted in the pdf version of this document but is

More information

II.Matrix. Creates matrix, takes a vector argument and turns it into a matrix matrix(data, nrow, ncol, byrow = F)

II.Matrix. Creates matrix, takes a vector argument and turns it into a matrix matrix(data, nrow, ncol, byrow = F) II.Matrix A matrix is a two dimensional array, it consists of elements of the same type and displayed in rectangular form. The first index denotes the row; the second index denotes the column of the specified

More information

Getting Started. Slides R-Intro: R-Analytics: R-HPC:

Getting Started. Slides R-Intro:   R-Analytics:   R-HPC: Getting Started Download and install R + Rstudio http://www.r-project.org/ https://www.rstudio.com/products/rstudio/download2/ TACC ssh username@wrangler.tacc.utexas.edu % module load Rstats %R Slides

More information

R basics workshop Sohee Kang

R basics workshop Sohee Kang R basics workshop Sohee Kang Math and Stats Learning Centre Department of Computer and Mathematical Sciences Objective To teach the basic knowledge necessary to use R independently, thus helping participants

More information

Package NetCluster. R topics documented: February 19, Type Package Version 0.2 Date Title Clustering for networks

Package NetCluster. R topics documented: February 19, Type Package Version 0.2 Date Title Clustering for networks Type Package Version 0.2 Date 2010-05-09 Title Clustering for networks Package NetCluster February 19, 2015 Author Mike Nowak , Solomon Messing , Sean

More information

Package slam. December 1, 2016

Package slam. December 1, 2016 Version 0.1-40 Title Sparse Lightweight Arrays and Matrices Package slam December 1, 2016 Data structures and algorithms for sparse arrays and matrices, based on inde arrays and simple triplet representations,

More information

Stat 302 Statistical Software and Its Applications Introduction to R

Stat 302 Statistical Software and Its Applications Introduction to R Stat 302 Statistical Software and Its Applications Introduction to R Yen-Chi Chen Department of Statistics, University of Washington Autumn 2016 1 / 23 Statistical Software There are many, many statistical

More information

Programming with R. Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman

Programming with R. Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman Programming with R Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman 1 Data Structures ˆ R has a rich set of self-describing data structures. > class(z) [1] "character" > class(x) [1] "data.frame"

More information

Introduction to R statistical environment

Introduction to R statistical environment Introduction to R statistical environment R Nano Course Series Aishwarya Gogate Computational Biologist I Green Center for Reproductive Biology Sciences History of R R is a free software environment for

More information

Package slam. February 15, 2013

Package slam. February 15, 2013 Package slam February 15, 2013 Version 0.1-28 Title Sparse Lightweight Arrays and Matrices Data structures and algorithms for sparse arrays and matrices, based on inde arrays and simple triplet representations,

More information

Why use R? Getting started. Why not use R? Introduction to R: Log into tak. Start R R or. It s hard to use at first

Why use R? Getting started. Why not use R? Introduction to R: Log into tak. Start R R or. It s hard to use at first Why use R? Introduction to R: Using R for statistics ti ti and data analysis BaRC Hot Topics October 2011 George Bell, Ph.D. http://iona.wi.mit.edu/bio/education/r2011/ To perform inferential statistics

More information

Recap From Last Time: Today s Learning Goals BIMM 143. Data analysis with R Lecture 4. Barry Grant.

Recap From Last Time: Today s Learning Goals BIMM 143. Data analysis with R Lecture 4. Barry Grant. BIMM 143 Data analysis with R Lecture 4 Barry Grant http://thegrantlab.org/bimm143 Recap From Last Time: Substitution matrices: Where our alignment match and mis-match scores typically come from Comparing

More information

Using R for statistics and data analysis

Using R for statistics and data analysis Introduction ti to R: Using R for statistics and data analysis BaRC Hot Topics October 2011 George Bell, Ph.D. http://iona.wi.mit.edu/bio/education/r2011/ Why use R? To perform inferential statistics (e.g.,

More information

STAT 213: R/RStudio Intro

STAT 213: R/RStudio Intro STAT 213: R/RStudio Intro Colin Reimer Dawson Last Revised February 10, 2016 1 Starting R/RStudio Skip to the section below that is relevant to your choice of implementation. Installing R and RStudio Locally

More information

Introduction to R. Adrienn Szabó. DMS Group, MTA SZTAKI. Aug 30, /62

Introduction to R. Adrienn Szabó. DMS Group, MTA SZTAKI. Aug 30, /62 Introduction to R Adrienn Szabó DMS Group, MTA SZTAKI Aug 30, 2014 1/62 1 What is R? What is R for? Who is R for? 2 Basics Data Structures Control Structures 3 ExtRa stuff R packages Unit testing in R

More information

Teaching Manual Math 2131

Teaching Manual Math 2131 Math 2131 Linear Algebra Labs with MATLAB Math 2131 Linear algebra with Matlab Teaching Manual Math 2131 Contents Week 1 3 1 MATLAB Course Introduction 5 1.1 The MATLAB user interface...........................

More information

University of Alberta

University of Alberta A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.

More information

Bjørn Helge Mevik Research Computing Services, USIT, UiO

Bjørn Helge Mevik Research Computing Services, USIT, UiO 23.11.2011 1 Introduction to R and Bioconductor: Computer Lab Bjørn Helge Mevik (b.h.mevik@usit.uio.no), Research Computing Services, USIT, UiO (based on original by Antonio Mora, biotek) Exercise 1. Fundamentals

More information

Installation and Introduction to Jupyter & RStudio

Installation and Introduction to Jupyter & RStudio Installation and Introduction to Jupyter & RStudio CSE 4/587 Data Intensive Computing Spring 2017 Prepared by Jacob Condello 1 Anaconda/Jupyter Installation 1.1 What is Anaconda? Anaconda is a freemium

More information

Introduction to R: Using R for Statistics and Data Analysis. BaRC Hot Topics

Introduction to R: Using R for Statistics and Data Analysis. BaRC Hot Topics Introduction to R: Using R for Statistics and Data Analysis BaRC Hot Topics http://barc.wi.mit.edu/hot_topics/ Why use R? Perform inferential statistics (e.g., use a statistical test to calculate a p-value)

More information

R: BASICS. Andrea Passarella. (plus some additions by Salvatore Ruggieri)

R: BASICS. Andrea Passarella. (plus some additions by Salvatore Ruggieri) R: BASICS Andrea Passarella (plus some additions by Salvatore Ruggieri) BASIC CONCEPTS R is an interpreted scripting language Types of interactions Console based Input commands into the console Examine

More information

A Brief Introduction to R

A Brief Introduction to R A Brief Introduction to R Babak Shahbaba Department of Statistics, University of California, Irvine, USA Chapter 1 Introduction to R 1.1 Installing R To install R, follow these steps: 1. Go to http://www.r-project.org/.

More information

Stat 302 Statistical Software and Its Applications Introduction to R

Stat 302 Statistical Software and Its Applications Introduction to R Stat 302 Statistical Software and Its Applications Introduction to R Fritz Scholz Department of Statistics, University of Washington Winter Quarter 2015 January 8, 2015 2 Statistical Software There are

More information

Introduction to the R Language

Introduction to the R Language Introduction to the R Language Data Types and Basic Operations Starting Up Windows: Double-click on R Mac OS X: Click on R Unix: Type R Objects R has five basic or atomic classes of objects: character

More information

An Introduction to R- Programming

An Introduction to R- Programming An Introduction to R- Programming Hadeel Alkofide, Msc, PhD NOT a biostatistician or R expert just simply an R user Some slides were adapted from lectures by Angie Mae Rodday MSc, PhD at Tufts University

More information

An introduction to R WS 2013/2014

An introduction to R WS 2013/2014 An introduction to R WS 2013/2014 Dr. Noémie Becker (AG Metzler) Dr. Sonja Grath (AG Parsch) Special thanks to: Dr. Martin Hutzenthaler (previously AG Metzler, now University of Frankfurt) course development,

More information

Introduction to R: Part I

Introduction to R: Part I Introduction to R: Part I Jeffrey C. Miecznikowski March 26, 2015 R impact R is the 13th most popular language by IEEE Spectrum (2014) Google uses R for ROI calculations Ford uses R to improve vehicle

More information

CSE/Math 485 Matlab Tutorial and Demo

CSE/Math 485 Matlab Tutorial and Demo CSE/Math 485 Matlab Tutorial and Demo Some Tutorial Information on MATLAB Matrices are the main data element. They can be introduced in the following four ways. 1. As an explicit list of elements. 2. Generated

More information

Matrix algebra. Basics

Matrix algebra. Basics Matrix.1 Matrix algebra Matrix algebra is very prevalently used in Statistics because it provides representations of models and computations in a much simpler manner than without its use. The purpose of

More information

Matlab Tutorial and Exercises for COMP61021

Matlab Tutorial and Exercises for COMP61021 Matlab Tutorial and Exercises for COMP61021 1 Introduction This is a brief Matlab tutorial for students who have not used Matlab in their programming. Matlab programming is essential in COMP61021 as a

More information

Short Introduction to R

Short Introduction to R Short Introduction to R Paulino Pérez 1 José Crossa 2 1 ColPos-México 2 CIMMyT-México June, 2015. CIMMYT, México-SAGPDB Short Introduction to R 1/51 Contents 1 Introduction 2 Simple objects 3 User defined

More information

Programming with R. Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman

Programming with R. Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman Programming with R Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman 1 Data Structures ˆ R has a rich set of self-describing data structures. > class(z) [1] "character" > class(x) [1] "data.frame"

More information

Introduction to R. Educational Materials 2007 S. Falcon, R. Ihaka, and R. Gentleman

Introduction to R. Educational Materials 2007 S. Falcon, R. Ihaka, and R. Gentleman Introduction to R Educational Materials 2007 S. Falcon, R. Ihaka, and R. Gentleman 1 Data Structures ˆ R has a rich set of self-describing data structures. > class(z) [1] "character" > class(x) [1] "data.frame"

More information

Introduction to MATLAB LAB 1

Introduction to MATLAB LAB 1 Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions

More information

Package icarus. March 4, 2017

Package icarus. March 4, 2017 Title Calibrates and Reweights Units in Samples Package icarus March 4, 2017 Provides user-friendly tools for calibration in survey sampling. The package is production-oriented, and its interface is inspired

More information

This document is designed to get you started with using R

This document is designed to get you started with using R An Introduction to R This document is designed to get you started with using R We will learn about what R is and its advantages over other statistics packages the basics of R plotting data and graphs What

More information

Introducion to R and parallel libraries. Giorgio Pedrazzi, CINECA Matteo Sartori, CINECA School of Data Analytics and Visualisation Milan, 09/06/2015

Introducion to R and parallel libraries. Giorgio Pedrazzi, CINECA Matteo Sartori, CINECA School of Data Analytics and Visualisation Milan, 09/06/2015 Introducion to R and parallel libraries Giorgio Pedrazzi, CINECA Matteo Sartori, CINECA School of Data Analytics and Visualisation Milan, 09/06/2015 Overview What is R R Console Input and Evaluation Data

More information

Getting Started with R

Getting Started with R Getting Started with R STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 Tool Some of you may have used

More information

Introduction to MATLAB. Simon O Keefe Non-Standard Computation Group

Introduction to MATLAB. Simon O Keefe Non-Standard Computation Group Introduction to MATLAB Simon O Keefe Non-Standard Computation Group sok@cs.york.ac.uk Content n An introduction to MATLAB n The MATLAB interfaces n Variables, vectors and matrices n Using operators n Using

More information

Advanced Econometric Methods EMET3011/8014

Advanced Econometric Methods EMET3011/8014 Advanced Econometric Methods EMET3011/8014 Lecture 2 John Stachurski Semester 1, 2011 Announcements Missed first lecture? See www.johnstachurski.net/emet Weekly download of course notes First computer

More information

Armstrong State University Engineering Studies MATLAB Marina 2D Arrays and Matrices Primer

Armstrong State University Engineering Studies MATLAB Marina 2D Arrays and Matrices Primer Armstrong State University Engineering Studies MATLAB Marina 2D Arrays and Matrices Primer Prerequisites The 2D Arrays and Matrices Primer assumes knowledge of the MATLAB IDE, MATLAB help, arithmetic operations,

More information

R and parallel libraries. Introduction to R for data analytics Bologna, 26/06/2017

R and parallel libraries. Introduction to R for data analytics Bologna, 26/06/2017 R and parallel libraries Introduction to R for data analytics Bologna, 26/06/2017 Outline Overview What is R R Console Input and Evaluation Data types R Objects and Attributes Vectors and Lists Matrices

More information

Introduction to MATLAB

Introduction to MATLAB Chapter 1 Introduction to MATLAB 1.1 Software Philosophy Matrix-based numeric computation MATrix LABoratory built-in support for standard matrix and vector operations High-level programming language Programming

More information

MATLAB = MATrix LABoratory. Interactive system. Basic data element is an array that does not require dimensioning.

MATLAB = MATrix LABoratory. Interactive system. Basic data element is an array that does not require dimensioning. Introduction MATLAB = MATrix LABoratory Interactive system. Basic data element is an array that does not require dimensioning. Efficient computation of matrix and vector formulations (in terms of writing

More information

Introduction to R. Nishant Gopalakrishnan, Martin Morgan January, Fred Hutchinson Cancer Research Center

Introduction to R. Nishant Gopalakrishnan, Martin Morgan January, Fred Hutchinson Cancer Research Center Introduction to R Nishant Gopalakrishnan, Martin Morgan Fred Hutchinson Cancer Research Center 19-21 January, 2011 Getting Started Atomic Data structures Creating vectors Subsetting vectors Factors Matrices

More information

Introduction to R Carolina Ferrari

Introduction to R Carolina Ferrari Introduction to R Carolina Ferrari carolina.ferrari01@universitadipavia.it Microbiology and Virology Unit, IRCCS Policlinico San Matteo What is R? R is a system for statistical analyses (linear and nonlinear

More information

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB? Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system

More information

Programming 1. Script files. help cd Example:

Programming 1. Script files. help cd Example: Programming Until now we worked with Matlab interactively, executing simple statements line by line, often reentering the same sequences of commands. Alternatively, we can store the Matlab input commands

More information

Programming for Chemical and Life Science Informatics

Programming for Chemical and Life Science Informatics Programming for Chemical and Life Science Informatics I573 - Week 7 (Statistical Programming with R) Rajarshi Guha 24 th February, 2009 Resources Download binaries If you re working on Unix it s a good

More information

Regression III: Advanced Methods

Regression III: Advanced Methods Lecture 2: Software Introduction Regression III: Advanced Methods William G. Jacoby Department of Political Science Michigan State University jacoby@msu.edu Getting Started with R What is R? A tiny R session

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse

More information

STAT 113: R/RStudio Intro

STAT 113: R/RStudio Intro STAT 113: R/RStudio Intro Colin Reimer Dawson Last Revised September 1, 2017 1 Starting R/RStudio There are two ways you can run the software we will be using for labs, R and RStudio. Option 1 is to log

More information

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks MATLAB Basics Stanley Liang, PhD York University Configure a MATLAB Package Get a MATLAB Student License on Matworks Visit MathWorks at https://www.mathworks.com/ It is recommended signing up with a student

More information

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

Python for Astronomers. Week 1- Basic Python

Python for Astronomers. Week 1- Basic Python Python for Astronomers Week 1- Basic Python UNIX UNIX is the operating system of Linux (and in fact Mac). It comprises primarily of a certain type of file-system which you can interact with via the terminal

More information

A Brief Introduction to MATLAB

A Brief Introduction to MATLAB A Brief Introduction to MATLAB MATLAB (Matrix Laboratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB was first designed for matrix computations:

More information

Topics for today Input / Output Using data frames Mathematics with vectors and matrices Summary statistics Basic graphics

Topics for today Input / Output Using data frames Mathematics with vectors and matrices Summary statistics Basic graphics Topics for today Input / Output Using data frames Mathematics with vectors and matrices Summary statistics Basic graphics Introduction to S-Plus 1 Input: Data files For rectangular data files (n rows,

More information

Part 1: Getting Started

Part 1: Getting Started Part 1: Getting Started 140.776 Statistical Computing Ingo Ruczinski Thanks to Thomas Lumley and Robert Gentleman of the R-core group (http://www.r-project.org/) for providing some tex files that appear

More information