Quick R Tutorial for Beginners

Size: px
Start display at page:

Download "Quick R Tutorial for Beginners"

Transcription

1 Quick R Tutorial for Beginners Version Rintaro Saito, University of California San Diego Haruo Suzuki, Keio University

2 0. Introduction R is one of the best languages to perform statistical analyses; it can analyze huge amount of data through scientific calculations, find tendencies among the data and visualize them. In this tutorial, you will learn fundamentals of R language. 1. Starting and ending R How to start R depends on the system you are using. In the UNIX system with R installed, you may be able to start R by just typing R. In Windows or Macintosh, double-click R icon to start. To end R, just type q() 2. Simple value assignments to variables Variables temporarily keep values. For example, if we want to have variable x to keep the value 123, type x <- 123 After that, you can just type x, then you will see value assigned to x. x <- 123 x [1] 123 Actually, R is capable of handling not only single value, but also vector 1. For example, if you want to assign vector (1, 3, 5) to variable y, you can do so with "c" before vector. y <- c(1, 3, 5) You can make vectors having numbers from 2 to 5 by y <- c(2,3,4,5). Alternatively you can simply type 1 Single value (scalar) can be deemed as one-dimensional vector. 2

3 y <- 2:5 as vectors are composed of consecutive numbers from 2 to 5. Exercise 2-1: Assign (10, 11, 12) to variable z, and display information of variable z. 3. Simple Arithmetic R can perform various arithmetic including addition, subtraction, multiplication and division. For example, if you input 1+2, you will get an answer of 3 as follows: [1] 3 In R, like most of other programming languages, +, -, * and / denotes to addition, subtraction, multiplication and division respectively. R can also manipulate vectors. For example, c(1, 2, 3) + c(4, 5, 6) will give (5, 7, 9), and c(1, 2, 3) * 2 will give (2, 4, 6). Arithmetic calculations with variables can also be performed. If (1, 2, 3) and (4, 5, 6) is assigned to x and y respectively, x + y will give a vector (5, 7, 9). A value of variables can be changed based on result of calculation. For example, after doing x <- c(1, 2, 3), x <- x * 2 will multiply x by 2, and the result will be overwritten to x itself. Exercise 3-1: Assign vector (1, 2, 3) to variable x and assign 2 to variable y. Then calculate x * y. What answer do you get? Exercise 3-2: Assign (1, 2, 3) to vector x, and multiply it by three. Put the result into x itself. 4. Simple vector arithmetic As already explained, list of numbers in bracket immediately after c represents vector. Dimension of vector, i.e. number of numbers in the given vector x can be obtained by length(x) 3

4 One can extract desired number from the vector. For example, after inputting x <- c(2,4,6,8,10), x[3] will give you 6 which is the third number of the vector. x[c(2,4)] will give you second and fourth numbers of the vector, and x[2:4] will give you numbers from second to fourth elements of the vector. You can also perform vector comparison. For example, x 5 will give you vectors containing TRUE and/or FALSE (abbreviated as T and F, respectively), where each element denotes whether corresponding number in x is greater than x or not. x <- c(2,4,6,8,10) x [1] x 5 [1] FALSE FALSE TRUE TRUE TRUE R function which will returns where the T s are in the given vector as index numbers. Using the vector c(f, F, T, T, T) returned by x 5, which(c(f, F, T, T, T)) will give you vector (3,4,5). More easily, which(x 5) will give you exactly the same answer. x <- c(2,4,6,8,10) which(x 5) [1] Using this vector which is composed of T and F, we can extract elements which correspond to T. x[ c(f, F, T, T, T)] By putting above together, it is sufficient to just type x[ x 5 ] to extract elements whose values are above 5. 4

5 Actually, we can also deal with set of strings as vector. For example, after typing x <- c("sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") x[2] will give you second string Monday. Various manipulations are available for a vector containing strings. grep("es", x) will give you indices of strings in vector x where string contain substring es. Thus the below inputs will return strings containing es. x <- c("sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") x[ grep("es", x) ] [1] "Tuesday" "Wednesday" You can assign name for each element in a vector using function name. For example, x <- c(2, 4, 6) names(x) <- c("first", "Second", "Third") will assign ( First, Second, Third ) to name attribute of variable x. x[[ "Second" ]] will give you second element. Various statistical functions are defined for vectors containing only numerical values. For example, sum(x) will give you sum of numerical elements in vector x, and mean(x) will give you average of numerical elements in x. The function sum will count number of T s in vector x containing only T and/or F. Thus x <- c(2,4,6,8,10) sum(x 5) will count number of numerical elements greater than 5 (i.e. 3 will be returned). Exercise 4-1: Create vector containing numerical values larger than 5 in vector (3, 1, 4, 1, 5, 9, 2, 6, 5). 5

6 Exercise 4-2: Assign names ( Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) for respective element of vector (1,2,3,4,5,6,7,8,9,10,11,12). Then extract third element from the vector using the string Mar. The extracted element should be Simple matrix construction and arithmetic By gathering vectors, it is possible to create a matrix using the function rbind. For example, if you want to create a matrix x = æ ç è ö where the first and second rows are (1,2,3) ø and (4,5,6), respectively, type x <- rbind(c(1,2,3), c(4,5,6)) Then just type x to display the matrix you have created. x <- rbind(c(1,2,3), c(4,5,6)) x [,1] [,2] [,3] [1,] [2,] Alternatively, x <- matrix(c(1, 4, 2, 5, 3, 6), nrow=2, ncol=3) or x <- matrix(c(1, 2, 3, 4, 5, 6), nrow=2, ncol=3, byrow=t) should return the identical matrix. The latter one means that matrix of size 2 3 will be created (nrow=2, ncol=3), and numbers are filled in each row first (byrow=t). Various functions are available for a matrix. nrow(x) and ncol(x) will return number of rows and columns of the matrix x respectively. x+1 will add 1 to all the elements in x and x * 2 will multiply all the elements in x by 2. Various kinds of arithmetic between matrices are also available. For example, after typing y <- rbind(c(2, 4, 6), c(8, 10, 12)), x + y will give you matrix where each element correspond to sum of corresponding element of x and y. x * y will give you matrix where each element correspond to product of corresponding element of 6

7 x and y 2. Any specific row or column can be extracted from a given matrix. For example, if you want to extract second row, you type: x[2,] [1] If you want to extract second column, you type: x[,2] [1] 2 5 t(x) will transpose the matrix x. t(x) [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 Average of each row of matrix x can be calculated as below 3. apply(x, 1, mean) [1] 2 5 Average of each column of matrix x can be calculated as below. apply(x, 2, mean) [1] Actually, matrix can be deemed as set of numbers in two dimensional array. R can also deal with array having n dimensions using array(vector, numbers of elements in each 2 Product of the matrices based on canonical mathematical definition can be calculated by the operator %*%. 3 Second parameter of 1 in apply function denotes that we will calculate average for each position of the first dimension (in this case, the first dimension is row number). Similarly, second parameter of 2 denotes that we will calculate average for each position of the second dimension (in this case, the second dimension is column number). 7

8 dimension). For example, x <- array(1:24, c(3,4,2)) will create three dimensional array with size of 3 4 2, and fills numbers in the given vector from the first dimension to the third dimension. x <- array(1:24, c(3,4,2)) x,, 1 # The first 3 4 array of the third dimension [,1] [,2] [,3] [,4] [1,] [2,] [3,] ,, 2 # The second 3 4 array of the third dimension [,1] [,2] [,3] [,4] [1,] [2,] [3,] Exercise 5-1: Calculate æ ç è ö æ + ç ø è ö. ø Exercise 5-2: For the matrix obtained in the above calculation, calculate row average and column average. 6. Simple list creation A list in R can gather various kinds of data into a single object to manage them. x <- list("ichiro", Seattle, "Right fielder") will create a list containing "Ichiro", Seattle, "Right fielder". Although a vector cannot 8

9 contain another vector, a list can contain a vector as shown in the example below. x <- list("ichiro", "Seattle", "Right fielder", c(184, 214, 225)) To extract the second element, you can type: x[[2]] You can assign names to each element as below: x <- list(player = "Ichiro", team = "Seattle", position = "Right fielder", hits = c(184, 214, 225)) Type x to confirm that names are given to each element: x $player [1] "Ichiro" $team [1] "Seattle" $position [1] "Right fielder" $hits [1] You can use assigned name to extract corresponding element. For example, x[["team"]] or x$team will extract Seattle. Exercise 6-2: Create a list containing San Diego, vector (32, 117), and California. Give names city, coordinates, area, and state to respective element. 9

10 10

11 7. Simple data frame creation Data frame is one of data class in R. It is one type of list and has two dimensional structure just like a matrix. Each row can be deemed as a sample, and each column can be deemed as attribute of the sample. Using this idea, data frame can represent a table. Following table gives data of five retired major league baseball players. Team at.bats hits home.runs Rose Reds Aaron Brewers Yastrzemski Red Sox Ripken Orioles Cobb Athletics The above table can be represented by data frame as follows: x <- data.frame( row.names = c("rose", "Aaron", "Yastrzemski", "Ripken", "Cobb"), team = c("reds", "Brewers", "Red Sox", "Orioles", "Athletics"), at.bats = c(14053, 12364, 11988, 11551, 11434), hits = c(4256, 3771, 3419, 3184, 4191), home.runs = c(160, 755, 452, 431, 117)) The function data.frame can generate a data frame and can be used in the format of data.frame(row.names = vector for column labels, column name 1 = vector 1, column name 2 = vector 2, ). You can check the content of x by typing x: x team at.bats hits home.runs Rose Reds Aaron Brewers Yastrzemski Red Sox Ripken Orioles Cobb Athletics Like a regular list, column name can be used to extract corresponding vector. x$hits [1]

12 Any part of data frame can be extracted as another data frame. For example, x[ c(1,5), c(2,3,4) ] will extract row 1, 5 and column 2, 3, 4 as a new data frame. You can also use row names and column names to do the same thing: x[ c("rose", "Cobb"), c("at.bats", "hits", "home.runs")] Various functions are defined for data frame. Let us get attributes associated with the data frame x. attributes(x) $names [1] "team" "at.bats" "hits" "home.runs" $row.names [1] "Rose" "Aaron" "Yastrzemski" "Ripken" "Cobb" $class [1] "data.frame" We got names, row.names and class. Type names(x), row.names(x) and class(x). You can obtain row names, column names and class of x respectively. Exercise 7-1: The below table shows characteristic values of each planet in solar system. Masses are represented in kg and diameters are represented in km. Make a data frame representing the table 4. Mass Diameter Satellites Mercury ,879 0 Venus ,690 0 Earth , As all the elements are numeric in this case, this data frame can be dealt as a matrix. as.matrix(x) will return x as a matrix. 12

13 Mars ,794 2 Jupiter , Saturn , Uranus , Neptune , Exercise 7-2: Using the created data frame in the previous exercise, calculate averages of mass, diameter and number of satellites. 8. Data reading from file So far, we have been inputting data directly. However in most of cases, numerical data may be prepared by files. So we will learn how to import data into a variable in R. First, prepare a text file with the following values. Let us name the file testdata.txt. We assume that the file is placed under the directory /Users/smith/TMP/ Using setwd, we change the working directory to /Users/smith/TMP. setwd("/users/smith/tmp") Then using scan function, read the data to a variable x. x <- scan("testdata.txt") Read 5 items x [1] You notice that the values are stored in x as a vector. R has a function, read.table, to read a table where each line is separated by TABs like the following example (file name is batters.txt ). Team At_Bat Hits Home_Runs 13

14 Bonds Giants Aaron Braves Ruth Yankees Rodriguez Yankees Mays Giants read.table can read this as data frame. x <- read.table("batters.txt", header = T, sep = "\t", row.names = 1) x Team At_Bat Hits Home_Runs Bonds Giants Aaron Braves Ruth Yankees Rodriguez Yankees Mays Giants The first parameter of the function read.table states that the name of the file to read is batters.txt. Subsequently, header = T states that there is a header for the table. sep = \t indicates that each line is separated by TAB. Finally, we can specify that there is one column for row names by row.names = 1. Since x will be a data frame, we can get number of hits by $Hits. Exercise 8: Save table in exercise 7-1 as tab-delimited file, and read it as data frame. 9. Writing data to file There are many cases where we want to have statistical results written in file rather than temporary seeing the results on screen. In this way, we can open the results by spreadsheet software or process the results using other programming language afterwards. Using "write function" is one of the simplest ways to output the results to files. This function enables us to output numerical values assigned to variable to file. For example, after assigning the vector to x as shown below, x <- c(10, 12, 15, 19, 21, 34) 14

15 the following line write(x, "outfile1.txt", ncolumns = 1) will write content of x to the file outfile1.txt. ncolumns = 1 states that the vector will be written to the file by one column. Content of outfile1.txt: write function also enable us to write matrix data to file as shown below: x <- matrix(c(1,2,3,4,5,6), nrow=2, ncol=3, byrow=t) x [,1] [,2] [,3] [1,] [2,] write(t(x), "outfile2.txt", ncolumns=ncol(x), sep="\t") t(x) transposes matrix x. If we do not do it, the matrix written in the file will look transposed. ncolumns=ncol(x) will tell R that the number of columns to output should be identical to that of matrix x. sep = \t indicates that the columns in the output file will be separated by tabs. Content of outfile2.txt: For writing data frame to a file, write.table function is provided. x <- data.frame( row.names = c("bonds", "Aaron", "Ruth", "Rodriguez", "Mays"), Team = c("giants", "Braves", "Yankees", "Yankees", "Giants"), 15

16 At_Bat = c(9847, 12364, 8398, 10341, 10881), Hits = c(2935, 3771, 2873, 3070, 3283), Home_Runs = c(762, 755, 714, 687, 660)) x[,c("hits", "Home_Runs")] Hits Home_Runs Bonds Aaron Ruth Rodriguez Mays write.table(x[,c("hits", "Home_Runs")], "outfile3.txt", sep="\t", row.names=t, col.names=na) With row.names=t and col.names=na, row names and column names will be added respectively (blank on the top-left). Content of outfile3: "" "Hits" "Home_Runs" "Bonds" "Aaron" "Ruth" "Rodriguez" "Mays" By giving quote=f, output will be without double quotations. Excercise 9: Using the data frame in the above example, calculate ratio of hits and at bat, and write the result to outfile4.txt. 10. Writing a program in a file So far, we have done our works interactively without saving what R codes we have written. However, when we repeat the same works with R, it is laborious to interactively write the same codes again and again. To solve this issue, we can write the set of codes in a file, and R can read the file to execute the codes written in the file. For example, we can prepare a text file with the following code. Let us name the 16

17 file "vecsumtest.r". x <- c(1,2,3,4,5) y <- c(2,4,6,8,10) z <- x + y Then giving source( "vecsumtest.r") will let R execute the set of codes in the file vecsumtest.r. You can check that based on the codes in vecsumtest.r, vectors are assigned to each of x, y and z. source( "vecsumtest.r") x [1] y [1] z [1] Exercise 10: Write the procedure in exercise 8 to a file dframetest.r and execute the procedure using source. 11. Defining functions In mathematics, function outputs the value which is determined by the input value. In programming, it often represents a defined set of procedures 5. For example, let us consider a function f which divides the sum of two given input values. In mathematics, it can be written as f(x, y) = (x + y) / 2. In R, it is written as follows by introducing the keyword function : f <- function(x, y){ return ((x + y) / 2) } In this way, a function with two parameters (x and y) is defined. And the returned value (output) will be (x + y) / 2. After defining f, 5 Probably subroutine may be the better terminology. 17

18 f(10, 20) will assign 10 and 20 to parameters x and y respectively and 15 will be returned as (x +y) / 2 = ( ) / 2 = 15. Here, return statement will return the value given just after it. You can also explicitly give the parameter names, x and y, as follows: f(x = 10, y = 20) The general way to define a function is name_of_function <- function(parameter 1, parameter 2,, ){ } # various procedures possibly using the given parameters 6 # return(return_value) Exercise 11: Implement a mathematical function f(x, a, b, c) = ax 2 + bx + c in R. Then calculate f(4, 3, 2, 1). 12. Making graphs R is equipped with functions capable of making graphs easily. plot function may be one of the simplest ones. It creates a plot in the two-dimensional space. For example, assigning the following vectors to x and y will create a plot with points on the locations (1,2), (3,4), (5,9), (7,7) and (9,8). x <- c(1,3,5,7,9) y <- c(2,4,9,7,8) plot(x, y, xlab="x Value", ylab="y Value") Labels on the x and y axes can be given to the parameters xlab and ylab respectively. 6 Optional parameters can be access with list( ) as a list. 18

19 X Value A plot created by plot function A bar graph can be created using barplot function. In the following example, a bar graph is created by giving the heights of each bar by vector x. The labels of each bar are given by the element names of the vector x, i.e. names(x). x <- c(1,2,3,2,10,1) names(x) <- c("a", "B", "C", "D", "E", "F") barplot(x) Y Value A B C D E F A bar graph created by barplot function hist function generates a histogram for a set of numbers given by a vector. 19

20 x <- c(3.2, 1.2, 4.2, 2.3, 3.4, 5.9, 5.2, 5.3, 4.1, 5.2, 3.2, 1.4) hist(x, xlab = "Test Value", main = "Test Histogram") The parameter main is used to state the title of the histogram. Test Histogram Frequency Test Value A generated histogram using hist function boxplot function creates a boxplot for the numbers given by the vectors. x1 <- c(11,12,11,10,11,11,12,13,15,12,11,10,12,13) x2 <- c(20,21,27,9,12,23,23,12,11,9,21,15,7,12,12,9,23,15) boxplot(x1, x2, names=c("data 1", "Data 2")) 20

21 Median Outlier The top 25% excluding outliers 50% of the data are within this range The bottom 25% excluding outliers Data 1 Data 2 Example of a box plot Exercise 12: Using the table (data frame) given in exercise 7-1, make a plot which describes relationship between masses of the planets and number of satellites. 13. Basic program structure R is equipped with programming grammars which are important and common in other programming languages. Here, some of the most important ones will be described briefly if-statement if statement gives you a way to execute a specific procedure only if a specified condition 7 is satisfied. For example, if you want to assign 1 to y when x 0, and otherwise assign 0 to y, you can write as follows: if (x 0){ y <- 1 7 When specifying a condition, logical operators such as & (logical AND) and (logical OR) can be used. 21

22 } else { y <- 0 } Investigate the value of y after doing x <- -5. Then after doing x <- 3, investigate the value of y again to make sure that the value has changed. The general form of if-statement is as follows: if (condition 1){ Set of procedures to execute when the condition 1 is satisfied } else if (condition 2){ Set of procedures to execute when the condition the condition 2 is satisfied (but the condition 1 is NOT met) } else if(condition 3){ Se of procedures to execute when condition 3 is satisfied (but condition 1 to 2 are NOT met) } else if : } else { Set of procedures to execute when NONE of the above conditions are satisfied } Exercise 13-1: Define a function which returns 1 when the input parameter is 0, and otherwise returns while-statement while-statement iterates a set of given procedures as long as the given condition is satisfied. The general form of while-statement is as follows 8 : while(condition){ 8 next-statement in the while-statement forces program to start the next iteration immediately. break-statement in while-statement forces the program to immediately stop the iteration and get out of the while-loop. 22

23 } A set of procedures to execute when the condition is satisfied For example, executing while(x <= 3){ print(x); x <- x + 1 } after doing x <- 1 will generate the output of 1 to 3. x <- 1 while (x <= 3){ print(x); x <- x + 1 } [1] 1 [1] 2 [1] 3 If you are to write this procedure as a program in a file, you may want to write each step line by line as follows so that the program will be easy to read. x <- 1 while (x <= 3){ print(x) x <- x + 1 } Initially, the value of x is 1, and the condition of the while-block i.e. x 3 is met. Thus, R goes into the while-block. The first procedure, print(x), which displays the value of x, is executed and 1 will be displayed. In the next procedure in the while-block (x <- x + 1), the value of x is increased by 1. Thus at the end of the first loop of while-block, x is 2. R interpreter then comes back to the condition check at the beginning of the while-block (x <= 3). The variable x is 2 at this point and still x 3 holds, so the procedures in the while-block will be executed again, i.e. displaying the value of x, 2, by print(x), and increasing the value of x by 1 by x <- x + 1. At the end of the while-block, x is 3. 23

24 R interpreter will then come back again to the condition check at the beginning of the while-block (x <= 3). The variable x is 3 at this point and still x 3 holds, so the procedures in the while-block will be executed again, i.e. displaying the value of x, which is 3, by print(x), and increasing the value of x by 1 by x <- x + 1. At the end of the while-block, x is 4. R interpreter will then come back again to the condition check at the beginning of the while-block (x <= 3). The variable x is 4 at this point and x 3 is NOT satisfied any more. Thus, R interpreter steps out of the while-loop. Final value of x is 4. Exercise 13-2: Using while-statement, display 1,3,5,7,9 and 11 respectively in each line for-statement for-statement also does iteration like while-statement. The for-statement assigns each of given elements to the given variable, starting from the first element to the last element in the given elements. After each assignment, the procedures in the for-block are executed. The general form of for-statement is: for(variables in elements){ } procedures For example, for (i in c(1,3,5)){ print(i) } will assign each of 1, 3, 5 into the variable i, and after each assignment, the procedures in the file-block are executed. Thus in this case, number 1 is displayed in the first iteration after the assignment, 3 is displayed in the second iteration after the assignment, and finally 5 is displayed in the third iteration after the assignment. The following example makes a vector of set of squared values of 1 to 5 9. x <- NULL for (i in 1:5){ x <- append(x, i**2) } 9 Actually using for-statement is unnecessary here. Just do x <- (1:5)**2. 24

25 x <- NULL assigns an empty vector to x. NULL represents an empty vector. In the for-statement, each value of 1 to 5 is assigned to i and after the assignment, the procedure in the for-block is executed. In the procedure in the for-block, the squared value of i (represented as i**2) is concatenated to the vector x. The function append(x, i) concatenates i to vector x 10 Exercise 13-3: Rewrite procedure in 12-2 using for-statement. 14. Other useful functions Here, some of the frequently used R functions are introduced briefly How to use help(function_name) will display how to use function_name variables and attributes ls() or objects() will display currently defined variables. class(variable_name) or mode(variable_name) will give you the type of the variable (object. For example, whether it is numerical variable, character, list or matrix) attributes(variable_name) will return attributes defined for the given variable variabl_name Family of "apply" functions sapply function will return a vector containing a set of output values from a given function after using each value in the given vector as a single input to that given function, each by each. func1_sub <- function(elm){ # a function expecting a single number as a parameter if(-1 <= elm & elm <= 1){ return (1) } else { return (0) } 10 The same procedure can be done with x <- c(x, i**2). c can be used to concatenate given vectors. 25

26 } func1 <- function(x){ # a function with a vector parameter x return(sapply(x, func1_sub)) } 14.4 Making figures curve function generates a graph for a given function. See help for details. Example: curve(dnorm, -7, +7) # Draws normal (Gaussian) distribution curve(cos(x)+cos(2*x), -2*pi, 2*pi, 1000) # 1000 is number of points curve(func1, -3, 3) # The function defined in 14.3 Family of "apply" functions. 26

27 27

INFORMATION TECHNOLOGY SPREADSHEETS. Part 1

INFORMATION TECHNOLOGY SPREADSHEETS. Part 1 INFORMATION TECHNOLOGY SPREADSHEETS Part 1 Page: 1 Created by John Martin Exercise Built-In Lists 1. Start Excel Spreadsheet 2. In cell B1 enter Mon 3. In cell C1 enter Tue 4. Select cell C1 5. At the

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

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

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

JME Language Reference Manual

JME Language Reference Manual JME Language Reference Manual 1 Introduction JME (pronounced jay+me) is a lightweight language that allows programmers to easily perform statistic computations on tabular data as part of data analysis.

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

Basics of R. > x=2 (or x<-2) > y=x+3 (or y<-x+3)

Basics of R. > x=2 (or x<-2) > y=x+3 (or y<-x+3) Basics of R 1. Arithmetic Operators > 2+2 > sqrt(2) # (2) >2^2 > sin(pi) # sin(π) >(1-2)*3 > exp(1) # e 1 >1-2*3 > log(10) # This is a short form of the full command, log(10, base=e). (Note) For log 10

More information

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 1.1 Inductive Reasoning What You Will Learn Inductive and deductive reasoning processes 1.1-2 Natural Numbers The set of natural numbers is also called the set of counting numbers. N = {1, 2, 3,

More information

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 1.1 Inductive Reasoning What You Will Learn Inductive and deductive reasoning processes 1.1-2 Natural Numbers The set of natural numbers is also called the set of counting numbers. N = {1, 2, 3,

More information

Introduction to R. UCLA Statistical Consulting Center R Bootcamp. Irina Kukuyeva September 20, 2010

Introduction to R. UCLA Statistical Consulting Center R Bootcamp. Irina Kukuyeva September 20, 2010 UCLA Statistical Consulting Center R Bootcamp Irina Kukuyeva ikukuyeva@stat.ucla.edu September 20, 2010 Outline 1 Introduction 2 Preliminaries 3 Working with Vectors and Matrices 4 Data Sets in R 5 Overview

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

How It All Stacks Up - or - Bar Charts with Plotly. ISC1057 Janet Peterson and John Burkardt Computational Thinking Fall Semester 2016

How It All Stacks Up - or - Bar Charts with Plotly. ISC1057 Janet Peterson and John Burkardt Computational Thinking Fall Semester 2016 * How It All Stacks Up - or - Bar Charts with Plotly ISC1057 Janet Peterson and John Burkardt Computational Thinking Fall Semester 2016 In a game of poker, players bet by tossing chips into the center

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

A Guide for the Unwilling S User

A Guide for the Unwilling S User A Guide for the Unwilling S User Patrick Burns Original: 2003 February 23 Current: 2005 January 2 Introduction Two versions of the S language are available a free version called R, and a commercial version

More information

Transformations Review

Transformations Review Transformations Review 1. Plot the original figure then graph the image of Rotate 90 counterclockwise about the origin. 2. Plot the original figure then graph the image of Translate 3 units left and 4

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

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions: Matrices A Matrix is an array of numbers: We talk about one matrix, or several matrices. There are many things we can do with them... Adding A Matrix (This one has 2 Rows and 3 Columns) To add two matrices:

More information

R (and S, and S-Plus, another program based on S) is an interactive, interpretive, function language.

R (and S, and S-Plus, another program based on S) is an interactive, interpretive, function language. R R (and S, and S-Plus, another program based on S) is an interactive, interpretive, function language. Available on Linux, Unix, Mac, and MS Windows systems. Documentation exists in several volumes, and

More information

Basic R Part 1 BTI Plant Bioinformatics Course

Basic R Part 1 BTI Plant Bioinformatics Course Basic R Part 1 BTI Plant Bioinformatics Course Spring 2013 Sol Genomics Network Boyce Thompson Institute for Plant Research by Jeremy D. Edwards What is R? Statistical programming language Derived from

More information

Conditional Formatting

Conditional Formatting Microsoft Excel 2013: Part 5 Conditional Formatting, Viewing, Sorting, Filtering Data, Tables and Creating Custom Lists Conditional Formatting This command can give you a visual analysis of your raw data

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

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

Control Flow Structures

Control Flow Structures Control Flow Structures STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 Expressions 2 Expressions R code

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

the R environment The R language is an integrated suite of software facilities for:

the R environment The R language is an integrated suite of software facilities for: the R environment The R language is an integrated suite of software facilities for: Data Handling and storage Matrix Math: Manipulating matrices, vectors, and arrays Statistics: A large, integrated set

More information

Introduction to R 21/11/2016

Introduction to R 21/11/2016 Introduction to R 21/11/2016 C3BI Vincent Guillemot & Anne Biton R: presentation and installation Where? https://cran.r-project.org/ How to install and use it? Follow the steps: you don t need advanced

More information

R package

R package R package www.r-project.org Download choose the R version for your OS install R for the first time Download R 3 run R MAGDA MIELCZAREK 2 help help( nameofthefunction )? nameofthefunction args(nameofthefunction)

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

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA MATLAB for beginners KiJung Yoon, 1 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA 1 MATLAB Tutorial I What is a matrix? 1) A way of representation for data (# of

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

Introduction to R for Beginners, Level II. Jeon Lee Bio-Informatics Core Facility (BICF), UTSW

Introduction to R for Beginners, Level II. Jeon Lee Bio-Informatics Core Facility (BICF), UTSW Introduction to R for Beginners, Level II Jeon Lee Bio-Informatics Core Facility (BICF), UTSW Basics of R Powerful programming language and environment for statistical computing Useful for very basic analysis

More information

Essentials. Week by. Week. All About Data. Algebra Alley

Essentials. Week by. Week. All About Data. Algebra Alley > Week by Week MATHEMATICS Essentials Algebra Alley Jack has 0 nickels and some quarters. If the value of the coins is $.00, how many quarters does he have? (.0) What s The Problem? Pebble Pebble! A pebble

More information

PAF Chapter Prep Section Mathematics Class 6 Worksheets for Intervention Classes

PAF Chapter Prep Section Mathematics Class 6 Worksheets for Intervention Classes The City School PAF Chapter Prep Section Mathematics Class 6 Worksheets for Intervention Classes Topic: Percentage Q1. Convert it into fractions and its lowest term: a) 25% b) 75% c) 37% Q2. Convert the

More information

Adding Three Fractions. Choosing the Best Graph

Adding Three Fractions. Choosing the Best Graph Adding Three Fractions Problem Solving: Choosing the Best Graph Adding Three Fractions How do we use good number sense with fractions? Let s review least common multiples. Look at the following set of

More information

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

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

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

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has.

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has. ASSIGNMENT 0 Introduction to Linear Algebra (Basics of vectors and matrices) Due 3:30 PM, Tuesday, October 10 th. Assignments should be submitted via e-mail to: matlabfun.ucsd@gmail.com You can also submit

More information

Stat 290: Lab 2. Introduction to R/S-Plus

Stat 290: Lab 2. Introduction to R/S-Plus Stat 290: Lab 2 Introduction to R/S-Plus Lab Objectives 1. To introduce basic R/S commands 2. Exploratory Data Tools Assignment Work through the example on your own and fill in numerical answers and graphs.

More information

AIMMS Function Reference - Date Time Related Identifiers

AIMMS Function Reference - Date Time Related Identifiers AIMMS Function Reference - Date Time Related Identifiers This file contains only one chapter of the book. For a free download of the complete book in pdf format, please visit www.aimms.com Aimms 3.13 Date-Time

More information

STAT 540: R: Sections Arithmetic in R. Will perform these on vectors, matrices, arrays as well as on ordinary numbers

STAT 540: R: Sections Arithmetic in R. Will perform these on vectors, matrices, arrays as well as on ordinary numbers Arithmetic in R R can be viewed as a very fancy calculator Can perform the ordinary mathematical operations: + - * / ˆ Will perform these on vectors, matrices, arrays as well as on ordinary numbers With

More information

GCSE-AS Mathematics Bridging Course. Chellaston School. Dr P. Leary (KS5 Coordinator) Monday Objectives. The Equation of a Line.

GCSE-AS Mathematics Bridging Course. Chellaston School. Dr P. Leary (KS5 Coordinator) Monday Objectives. The Equation of a Line. GCSE-AS Mathematics Bridging Course Chellaston School Dr (KS5 Coordinator) Monday Objectives The Equation of a Line Surds Linear Simultaneous Equations Tuesday Objectives Factorising Quadratics & Equations

More information

2.0 MATLAB Fundamentals

2.0 MATLAB Fundamentals 2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,

More information

Introduction to Python Practical 1

Introduction to Python Practical 1 Introduction to Python Practical 1 Daniel Carrera & Brian Thorsbro October 2017 1 Introduction I believe that the best way to learn programming is hands on, and I tried to design this practical that way.

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

CS 251 Intermediate Programming More on classes

CS 251 Intermediate Programming More on classes CS 251 Intermediate Programming More on classes Brooke Chenoweth University of New Mexico Spring 2018 Empty Class public class EmptyClass { Has inherited methods and fields from parent (in this case, Object)

More information

Unit 5 Test 2 MCC5.G.1 StudyGuide/Homework Sheet

Unit 5 Test 2 MCC5.G.1 StudyGuide/Homework Sheet Unit 5 Test 2 MCC5.G.1 StudyGuide/Homework Sheet Tuesday, February 19, 2013 (Crosswalk Coach Page 221) GETTING THE IDEA! An ordered pair is a pair of numbers used to locate a point on a coordinate plane.

More information

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the

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

Introduction to MATLAB Practical 1

Introduction to MATLAB Practical 1 Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior

More information

INTRODUCTION TO GAMS 1 Daene C. McKinney CE385D Water Resources Planning and Management The University of Texas at Austin

INTRODUCTION TO GAMS 1 Daene C. McKinney CE385D Water Resources Planning and Management The University of Texas at Austin INTRODUCTION TO GAMS 1 Daene C. McKinney CE385D Water Resources Planning and Management The University of Texas at Austin Table of Contents 1. Introduction... 2 2. GAMS Installation... 2 3. GAMS Operation...

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

Arrays III and Enumerated Types

Arrays III and Enumerated Types Lecture 15 Arrays III and Enumerated Types Multidimensional Arrays & enums CptS 121 Summer 2016 Armen Abnousi Multidimensional Arrays So far we have worked with arrays with one dimension. Single dimensional

More information

ME305: Introduction to System Dynamics

ME305: Introduction to System Dynamics ME305: Introduction to System Dynamics Using MATLAB MATLAB stands for MATrix LABoratory and is a powerful tool for general scientific and engineering computations. Combining with user-friendly graphics

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

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

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

STAT 20060: Statistics for Engineers. Statistical Programming with R

STAT 20060: Statistics for Engineers. Statistical Programming with R STAT 20060: Statistics for Engineers Statistical Programming with R Why R? Because it s free to download for everyone! Most statistical software is very, very expensive, so this is a big advantage. Statisticians

More information

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory provides a brief

More information

Statistical Computing (36-350)

Statistical Computing (36-350) Statistical Computing (36-350) Lecture 1: Introduction to the course; Data Cosma Shalizi and Vincent Vu 29 August 2011 Why good statisticians learn how to program Independence: otherwise, you rely on someone

More information

1.2 Data Classification

1.2 Data Classification SECTION 1.2 DATA CLASSIFICATION 11 1.2 Data Classification What You SHOULD LEARN How to distinguish between qualitative data and quantitative data How to classify data with respect to the four levels of

More information

Lecture 09: Feb 13, Data Oddities. Lists Coercion Special Values Missingness and NULL. James Balamuta STAT UIUC

Lecture 09: Feb 13, Data Oddities. Lists Coercion Special Values Missingness and NULL. James Balamuta STAT UIUC Lecture 09: Feb 13, 2019 Data Oddities Lists Coercion Special Values Missingness and NULL James Balamuta STAT 385 @ UIUC Announcements hw03 slated to be released on Thursday, Feb 14th, 2019 Due on Wednesday,

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

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

Sand Pit Utilization

Sand Pit Utilization Sand Pit Utilization A construction company obtains sand, fine gravel, and coarse gravel from three different sand pits. The pits have different average compositions for the three types of raw materials

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

B.2 Measures of Central Tendency and Dispersion

B.2 Measures of Central Tendency and Dispersion Appendix B. Measures of Central Tendency and Dispersion B B. Measures of Central Tendency and Dispersion What you should learn Find and interpret the mean, median, and mode of a set of data. Determine

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

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

C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5

C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5 C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5 1. Pointers As Kernighan and Ritchie state, a pointer is a variable that contains the address of a variable. They have been

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Introduction MATLAB is an interactive package for numerical analysis, matrix computation, control system design, and linear system analysis and design available on most CAEN platforms

More information

AN INTRODUCTION TO MATLAB

AN INTRODUCTION TO MATLAB AN INTRODUCTION TO MATLAB 1 Introduction MATLAB is a powerful mathematical tool used for a number of engineering applications such as communication engineering, digital signal processing, control engineering,

More information

Introduction to R. Biostatistics 615/815 Lecture 23

Introduction to R. Biostatistics 615/815 Lecture 23 Introduction to R Biostatistics 615/815 Lecture 23 So far We have been working with C Strongly typed language Variable and function types set explicitly Functional language Programs are a collection of

More information

Put the following equations to slope-intercept form then use 2 points to graph

Put the following equations to slope-intercept form then use 2 points to graph Tuesday September 23, 2014 Warm-up: Put the following equations to slope-intercept form then use 2 points to graph 1. 4x - 3y = 8 8 x 6y = 16 2. 2x + y = 4 2x + y = 1 Tuesday September 23, 2014 Warm-up:

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

1 Introduction. 1.1 What is Statistics?

1 Introduction. 1.1 What is Statistics? 1 Introduction 1.1 What is Statistics? MATH1015 Biostatistics Week 1 Statistics is a scientific study of numerical data based on natural phenomena. It is also the science of collecting, organising, interpreting

More information

UTORid: Comments are not required except where indicated, although they may help us mark your answers.

UTORid: Comments are not required except where indicated, although they may help us mark your answers. CSC 121H1 S 2018 Quiz 2 (Version B) March 19, 2018 Duration 35 minutes Aids allowed: none Last Name: Lecture Section: Instructor: UTORid: First Name: L0101 (MWF12) Mark Kazakevich Do not turn this page

More information

Getting started with MATLAB

Getting started with MATLAB Getting started with MATLAB You can work through this tutorial in the computer classes over the first 2 weeks, or in your own time. The Farber and Goldfarb computer classrooms have working Matlab, but

More information

Overview. Linear Algebra Notation. MATLAB Data Types Data Visualization. Probability Review Exercises. Asymptotics (Big-O) Review

Overview. Linear Algebra Notation. MATLAB Data Types Data Visualization. Probability Review Exercises. Asymptotics (Big-O) Review Tutorial 1 1 / 21 Overview Linear Algebra Notation Data Types Data Visualization Probability Review Exercises Asymptotics (Big-O) Review 2 / 21 Linear Algebra Notation Notation and Convention 3 / 21 Linear

More information

Route Map (Start September 2012) Year 9

Route Map (Start September 2012) Year 9 Route Map (Start September 2012) Year 9 3 th 7 th Sept 10 th -14 th Sept 17 th 21 st Sept 24 th 28 th Sept 1 st -5 th Oct 8 th -12 th Oct 15 th 19 th Oct 22 nd -26 th Oct 29 th Oct-2 nd Nov 5 th -9 th

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

Learning from Data Introduction to Matlab

Learning from Data Introduction to Matlab Learning from Data Introduction to Matlab Amos Storkey, David Barber and Chris Williams a.storkey@ed.ac.uk Course page : http://www.anc.ed.ac.uk/ amos/lfd/ This is a modified version of a text written

More information

RTL Reference 1. JVM. 2. Lexical Conventions

RTL Reference 1. JVM. 2. Lexical Conventions RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's

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

NCC Cable System Order

NCC Cable System Order Syscode 0081 Agency Beacon Media System Name Spectrum/Park Cities, TX Advertiser Ed Meier for Congress $2,421.00 Commission $363.15 Net $2,057.85 198 1 AEN VARIOUS 2/26/18 3/4/18 19:00 24:00 X X X X X

More information

Maths for Signals and Systems Linear Algebra in Engineering. Some problems by Gilbert Strang

Maths for Signals and Systems Linear Algebra in Engineering. Some problems by Gilbert Strang Maths for Signals and Systems Linear Algebra in Engineering Some problems by Gilbert Strang Problems. Consider u, v, w to be non-zero vectors in R 7. These vectors span a vector space. What are the possible

More information

GREENWOOD PUBLIC SCHOOL DISTRICT Algebra III Pacing Guide FIRST NINE WEEKS

GREENWOOD PUBLIC SCHOOL DISTRICT Algebra III Pacing Guide FIRST NINE WEEKS GREENWOOD PUBLIC SCHOOL DISTRICT Algebra III FIRST NINE WEEKS Framework/ 1 Aug. 6 10 5 1 Sequences Express sequences and series using recursive and explicit formulas. 2 Aug. 13 17 5 1 Sequences Express

More information

7 Sept 29-Oct 3. 8 Oct 6-10

7 Sept 29-Oct 3. 8 Oct 6-10 Fifth Grade Math Curriculum Map Week 1 Aug 18-22 2 Aug 25-29 3 Sept 2-5 4 Sept 8-12 5 Sept 15-19 2014-2015 (I can statements and testing dates included) 6 Sept 22-26 7 Sept 29-Oct 3 8 Oct 6-10 9 Oct 13-17

More information

GS Analysis of Microarray Data

GS Analysis of Microarray Data GS01 0163 Analysis of Microarray Data Keith Baggerly and Kevin Coombes Section of Bioinformatics Department of Biostatistics and Applied Mathematics UT M. D. Anderson Cancer Center kabagg@mdanderson.org

More information

file:///users/williams03/a/workshops/2015.march/final/intro_to_r.html

file:///users/williams03/a/workshops/2015.march/final/intro_to_r.html Intro to R R is a functional programming language, which means that most of what one does is apply functions to objects. We will begin with a brief introduction to R objects and how functions work, and

More information

MATLAB SUMMARY FOR MATH2070/2970

MATLAB SUMMARY FOR MATH2070/2970 MATLAB SUMMARY FOR MATH2070/2970 DUNCAN SUTHERLAND 1. Introduction The following is inted as a guide containing all relevant Matlab commands and concepts for MATH2070 and 2970. All code fragments should

More information

Statlab Workshop on S-PLUS

Statlab Workshop on S-PLUS Statlab Workshop on S-PLUS Instructor: Marios Panayides September 25, 2003 1 General Outline This S-PLUS basics workshop will mainly focus on the S programming language through the S-PLUS software package.

More information

The goal of this handout is to allow you to install R on a Windows-based PC and to deal with some of the issues that can (will) come up.

The goal of this handout is to allow you to install R on a Windows-based PC and to deal with some of the issues that can (will) come up. Fall 2010 Handout on Using R Page: 1 The goal of this handout is to allow you to install R on a Windows-based PC and to deal with some of the issues that can (will) come up. 1. Installing R First off,

More information

MATLAB Project: Getting Started with MATLAB

MATLAB Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos, sin,

More information

An Introductory Tutorial: Learning R for Quantitative Thinking in the Life Sciences. Scott C Merrill. September 5 th, 2012

An Introductory Tutorial: Learning R for Quantitative Thinking in the Life Sciences. Scott C Merrill. September 5 th, 2012 An Introductory Tutorial: Learning R for Quantitative Thinking in the Life Sciences Scott C Merrill September 5 th, 2012 Chapter 2 Additional help tools Last week you asked about getting help on packages.

More information

Command Line and Python Introduction. Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 2: January 7, 2016

Command Line and Python Introduction. Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 2: January 7, 2016 Command Line and Python Introduction Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 2: January 7, 2016 Today Assignment #1! Computer architecture Basic command line skills Python fundamentals

More information

MATLAB for Experimental Research. Fall 2018 Vectors, Matrices, Matrix Operations

MATLAB for Experimental Research. Fall 2018 Vectors, Matrices, Matrix Operations MATLAB for Experimental Research Fall 2018 Vectors, Matrices, Matrix Operations Matlab is more than a calculator! The array is a fundamental form that MATLAB uses to store and manipulate data. An array

More information

MATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline

MATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline MATLAB Tutorial EE351M DSP Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Kitaek Bae Outline Part I: Introduction and Overview Part II: Matrix manipulations and common functions Part III: Plots

More information

R:If, else and loops

R:If, else and loops R:If, else and loops Presenter: Georgiana Onicescu January 19, 2012 Presenter: Georgiana Onicescu R:ifelse,where,looping 1/ 17 Contents Vectors Matrices If else statements For loops Leaving the loop: stop,

More information

Matlab Tutorial: Basics

Matlab Tutorial: Basics Matlab Tutorial: Basics Topics: opening matlab m-files general syntax plotting function files loops GETTING HELP Matlab is a program which allows you to manipulate, analyze and visualize data. MATLAB allows

More information