Introduction to R 21/11/2016
|
|
- Oliver Dennis
- 5 years ago
- Views:
Transcription
1 Introduction to R 21/11/2016 C3BI Vincent Guillemot & Anne Biton
2 R: presentation and installation
3 Where?
4 How to install and use it? Follow the steps: you don t need advanced rights to install it! Open the R GUI. Test a command: plot(-10:10, (-10:10)ˆ2). Open an R script and save it in your working directory.
5 Rstudio
6 ...
7 The few commands you must know Command What it does read.table Read a tabulated file. write.table Write a matrix or data frame. plot Command for graphical representation. x <- 1 Assign sthg (here 1) to object x. 1:10 Create a vector containing integers 1 to 10. x[1:10] Extract a subvector from x.
8 ... Command What it does c(2, 5) Create a vector containing 2 and 5. A[, 2:5] Extract columns 2 to 5 of matrix A. DF$variable Extract from data frame DF its column called variable.?rnorm Get help on the function called rnorm.??gaussian Get help on the topic gaussian.
9 A beginner s test If you already know the previous commands move to the back of the room, you can work independently on the handout and the exercises and go home whenever you are finished ; If you are not familiar with these commands, move to the front of the room. In any case, please ask us any R related question during the class!
10 Basic commands
11 Prompt A prompt is a special character that appears in the R console: > means that R is awaiting for an R command ; + means that R is awaiting for the end of the current command; A blank prompt means that R is computing something. E.g., type: 1+1 2* 3 Sys.sleep(10)
12 Brackets Brackets Use () In functions, e.g. sin(2*pi). [] While indexing, e.g. x[1:2]. {} In code blocks, e.g. { x <- rnorm(10) y <- x[1:2] mean(y) }
13 Writing your scripts: survival tips 1. Use spaces: x <- -1 is OK, x<--1 not so much Indent! 3. Save your scripts, it s so easy with RStudio. 4. Comment, comment, comment (use #). You are collaborating with at least one person: your future self! Hadley Wickham
14 What this course is about Write short R programs Read and predict the outcome of simple R functions / programs Make graphical representations Read data and write tables To go beyond (or slower), there s a lot of material available online: Quick-R, TryR, Data Camp, cookbook-r etc.
15 Types of exercises Three levels: 1. Copy & paste some code and see what it does. 2. Read some code and explain what it does. 3. Create your own code to answer a question.
16 Ex Copy and execute the following command: log(exp(2)). 2. What does this code do: log10(10ˆ3)? 3. Find a function to run a t-test.
17 R Objects
18 Types... The type of an object is directly associated to the way it is stored in memory: character : let <- "a" double : nbr <- 2.0 integer : intg <- 1L logical : TRUE or T or FALSE or F Particular values: NA, +Inf, NaN
19 Types... and classes The class of an object describes how different values are structured within the object: vector: v <- c("a", "b", "a") factor: fac <- factor(v) matrix: M <- matrix(1:4, 2, 2) data.frame: D <- data.frame(v, fac) list, etc.
20 Transformations as.integer as.numeric as.character as.factor as.vector...
21 Classes Here are the classes that you need to know of: vectors and factors, matrices, data-frames, lists, functions.
22 FAMuSSS FAMuSSS : The Functional Single Nucleotide Polymorphisms Associated with Human Muscle Size and Strength Study
23 Load an RData file In the RData file famusss.rdata, there is an example of each of the 5 R classes we mentioned: Name Class Content ndrm.diff Vector Difference in strength in the non-dominant arm snp1 Factor SNP rs577x located in the gene ACTN3 M Matrix Matrix containing the Age, height and weight of the individuals D Data-frame Sample data extracted from the FAMuSSS data L List List containing various objects bmi Function Computes the BMI of an individual from their weight (lb) and height (in)
24 Ex Load the objects with the following command load("famusss.rdata") 2. Print all the objects: what type of data do they contain? 3. What is the BMI of a person 70 inch tall person weighting 150 lb? 4. What does L$Dimensions do? What does names(l) do? 5. Extract the element called GenderTable from L?
25 Vectors Create them with the combine function c or with the : operator: x <- c(1, 10, -4, 5.0) i <- 1:10 Access elements from a vector with the square brackets x[1] ## [1] 1 x[3:4] ## [1] -4 5
26 Factors You can create factors in a number of ways, one of them is with function gl: f0 <- gl(n = 3, k = 6, labels = c("crtl", "A", "B"))
27 Ex What does f0 == "A" do? 2. What do rep and seq do? 3. Create a vector called v of length What does v[f0 == "A"] do? 5. Extract from v the values for which f0 is equal to B?
28 Matrices A matrix is a two-dimensional kind of vector: A <- matrix(0, 2, 2) B <- matrix(c("un","deux","trois","quatre"), 2, 2) A[1,] ## [1] 0 0 B[2,2] ## [1] "quatre"
29 Data frames A data frame is a two-dimensional structure that allows different types for its columns: D <- data.frame(a=1:10, b=letters[1:10], cos=cos(1:10)) D[1:2,2:3] ## b cos ## 1 a ## 2 b D$a[3] ## [1] 3 D[[1]] ## [1]
30 Lists In R, data frames are special lists: L <- list(1:10, b=3, f=cos, char=letters[5:7]) names(l) ## [1] "" "b" "f" "char"
31 Block of code A block allows to gather several commands in order to execute all of them at once! { } a <- 1 b <- 2 It is used in functions, loops (for, while... ) Control-flow constructs (?Control).
32 Functions Syntax : f <- function(arg1=,...) {Commands}. f ends with a return. What can f return? Whatever you like (e.g. in a list). Indent!
33 Ex. 4 Create a matrix filled with random numbers (rnorm). Compute the sum of each column (colsums). Which elements are > 0? Create a second matrix filled with 1s. It should have the same dimensions as the first matrix. Combine it with the first matrix (rbind or cbind). Write a function returning the square and the square root of a positive real number.
34 for loops Repeat a block, depending on an iterator i, n times. for (i in 1:10) { j <- i^2 + i + 1 print(j) } In general, we want to save the result: s <- rep(na, 10) for (i in 1:10) { s[i] <- i^2 + i + 1 } s
35 Ex. 5 What does this loop do? library(tm) library(stringr) aveu <- removepunctuation(scan("phedre.txt",what = "")) nba <- 0 ; nbe <- 0 ; nbi <- 0 ; nbo <- 0 ; nbu <- 0 for (mot in aveu) { nba <- nba + str_count(mot, "a") nbe <- nbe + str_count(mot, "e") nbi <- nbi + str_count(mot, "i") nbo <- nbo + str_count(mot, "o") nbu <- nbu + str_count(mot, "u") } c(a=nba, e=nbe, i=nbi, o=nbo, u=nbu)
36 if, else The random p-value generator: r <- runif(1) if (r < 0.05) { print("youpi!") } else if (r < 0.1) { print("i still trust my result!") } else { print(" :'( ") }
37 Read and write data
38 Many available commands Command Read Save data Yes No load Yes No save No Yes read.table Yes Yes write.table No Yes read.* Yes Yes write.* No Yes
39 Correspondance Figure 1: diagrammer
40 data Example: data(cars). Before and after: ls(). Class of the loaded object: class(cars). Quick object exploration: str(cars). Only the beginning of the table: head(cars).
41 Working directory You may (will) want to change the working directory in which your commands will look for data and save your outputs. You can do this: with the commands setwd and getwd, in a much simpler way with RStudio : Session Set working directory...
42 Tabulated data Column names, lines separated with and EOL (end of line), column separator (tab, ;, etc.), the same number of columns per line.
43 long and wide formats: a wide table ## ctrl trt1 trt2 ## 1: ## 2: ## 3: ## 4: ## 5: ## 6: ## 7: ## 8: ## 9: ## 10:
44 long and wide formats: a long table ## values ind ## 1: 4.17 ctrl ## 2: 5.58 ctrl ## 3: 5.18 ctrl ## 4: 6.11 ctrl ## 5: 4.50 ctrl ## --- ## 26: 5.29 trt2 ## 27: 4.92 trt2 ## 28: 6.15 trt2 ## 29: 5.80 trt2 ## 30: 5.26 trt2
45 read.table 5 important parameters: file where the file is, header whether the first line contains the names of the columns, sep column separator, dec decimal point (3, 1419 or ?), skip how many lines should be skipped.
46 write.table 4 important parameter: x matrix or data.frame to save, file where the file should be stored, sep column separator, dec decimal point (3, 1419 or ?),
47 save and load save can write any R object into an RData file. load reads RData files. Example : x <- 1:10 ; a <- "toto" ; objetaunomtreslong <- pi save(x, a, objetaunomtreslong, file="sauvegarde.rdata") rm(list=ls()) load("sauvegarde.rdata")
48 Plots
49 plot Syntax : plot(objet,...)! Parameter Role main Main title xlab & ylab Axis title xlim & ylim Axis limits type Type of graph : points, lines etc... col Color, e.g. black, red, green...
50 Ex. 6 Apply plot to any function, e.g. choose one among the already built-in functions: sin, cos, exp, log, sqrt...
51 Ex. 7 With plot and grid, reproduce this plot:
52 Add points, and lines or a function You can draw a graph on an existing plot with the following commands: points to add points, lines to add lines, plot(f, add=true,...) to add a function.
53 Ex Generate two variables, x and y, linearly linked to one another. (do not forget to add some noise) 2. Represent the scatter-plot of the two variables with plot. 3. Add to the plot the underlying linear model with lines or plot.
54 Colors, dashes, symbols and width 4 important parameters : pch : to choose the type of point (circle, triangle, etc.), lty : (line type) to choose the line type, col : (color) to choose the color, lwd : (line width) to set the width.
55 legend Argument Meaning x, y Legend position... legend Legend text. bty Type of box = "o" (with) or "n" (without).
56 Ex. 9 Add a legend to this graph plot(1:10, type="b", col="steelblue", lwd=2). 1. Add a legend at the following coordinates: (1, 7). 2. Add a legend without a box around it, in the upper left corner of the graph. 3. Add the legend wherever you want it with locator(1).
57 Combining plots is easy with layout! 1. Create the layout, a matrix indicating the positions and orders of the plots. 2. plot the graphs to populate the layout. Ex: x <- rnorm(100) # Data M <- rbind(1, 2:3) # 3 graphs in the layout layout(m) # Create the layout and put the plot(x) # 1st... hist(x) # 2nd... boxplot(x) # and 3rd graphs
58 Here is the layout we used: 1 2 3
59 The resulting plot x Index Histogram of x Frequency x
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 informationA (very) short introduction to R
A (very) short introduction to R Paul Torfs & Claudia Brauer Hydrology and Quantitative Water Management Group, Wageningen University, The Netherlands 4 August 2017 1 Introduction R is a powerful language
More informationMBV4410/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 informationR is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website:
Introduction to R R R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website: http://www.r-project.org/ Code Editor: http://rstudio.org/
More informationA (very) short introduction to R
A (very) short introduction to R Paul Torfs & Claudia Brauer Hydrology and Quantitative Water Management Group Wageningen University, The Netherlands 1 Introduction 16 April 2012 R is a powerful language
More informationTransform and Tidy (Wrangle) Data with R - Required Read Bojan Duric
Transform and Tidy (Wrangle) Data with R - Required Read Bojan Duric This Notebook is selection of A Very (short) Introduction to R by Paul Torfs & Claudia Brauer and R for Data Scince " by Hadley Wickham
More informationA (very) short introduction to R
A (very) short introduction to R Paul Torfs & Claudia Brauer Hydrology and Quantitative Water Management Group Wageningen University, The Netherlands 1 Introduction 3 March 2014 R is a powerful language
More informationStatistical Software Camp: Introduction to R
Statistical Software Camp: Introduction to R Day 1 August 24, 2009 1 Introduction 1.1 Why Use R? ˆ Widely-used (ever-increasingly so in political science) ˆ Free ˆ Power and flexibility ˆ Graphical capabilities
More informationR: 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 informationExtremely 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 informationR practice. Eric Gilleland. 20th May 2015
R practice Eric Gilleland 20th May 2015 1 Preliminaries 1. The data set RedRiverPortRoyalTN.dat can be obtained from http://www.ral.ucar.edu/staff/ericg. Read these data into R using the read.table function
More informationMails : ; 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 informationBGGN 213 Working with R packages Barry Grant
BGGN 213 Working with R packages Barry Grant http://thegrantlab.org/bggn213 Recap From Last Time: Why it is important to visualize data during exploratory data analysis. Discussed data visualization best
More informationSTAT 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 informationStatistics for Biologists: Practicals
Statistics for Biologists: Practicals Peter Stoll University of Basel HS 2012 Peter Stoll (University of Basel) Statistics for Biologists: Practicals HS 2012 1 / 22 Outline Getting started Essentials of
More informationAdvanced 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 informationComputer lab 2 Course: Introduction to R for Biologists
Computer lab 2 Course: Introduction to R for Biologists April 23, 2012 1 Scripting As you have seen, you often want to run a sequence of commands several times, perhaps with small changes. An efficient
More informationPOL 345: Quantitative Analysis and Politics
POL 345: Quantitative Analysis and Politics Precept Handout 1 Week 2 (Verzani Chapter 1: Sections 1.2.4 1.4.31) Remember to complete the entire handout and submit the precept questions to the Blackboard
More informationIntroduction 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 informationA 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 informationAuthor: Leonore Findsen, Qi Wang, Sarah H. Sellke, Jeremy Troisi
0. Downloading Data from the Book Website 1. Go to http://bcs.whfreeman.com/ips8e 2. Click on Data Sets 3. Click on Data Sets: PC Text 4. Click on Click here to download. 5. Right Click PC Text and choose
More informationINTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX
INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar
More informationApplied Calculus. Lab 1: An Introduction to R
1 Math 131/135/194, Fall 2004 Applied Calculus Profs. Kaplan & Flath Macalester College Lab 1: An Introduction to R Goal of this lab To begin to see how to use R. What is R? R is a computer package for
More informationIntroduction 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 informationRecap 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 informationDescription/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 informationlimma: A brief introduction to R
limma: A brief introduction to R Natalie P. Thorne September 5, 2006 R basics i R is a command line driven environment. This means you have to type in commands (line-by-line) for it to compute or calculate
More informationUniversity of Wollongong School of Mathematics and Applied Statistics. STAT231 Probability and Random Variables Introductory Laboratory
1 R and RStudio University of Wollongong School of Mathematics and Applied Statistics STAT231 Probability and Random Variables 2014 Introductory Laboratory RStudio is a powerful statistical analysis package.
More informationData 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 informationIntroduction to MATLAB
Introduction to MATLAB Introduction: MATLAB is a powerful high level scripting language that is optimized for mathematical analysis, simulation, and visualization. You can interactively solve problems
More informationCanadian Bioinforma,cs Workshops.
Canadian Bioinforma,cs Workshops www.bioinforma,cs.ca Module #: Title of Module 2 Modified from Richard De Borja, Cindy Yao and Florence Cavalli R Review Objectives To review the basic commands in R To
More informationIntroduction to R and R-Studio Toy Program #1 R Essentials. This illustration Assumes that You Have Installed R and R-Studio
Introduction to R and R-Studio 2018-19 Toy Program #1 R Essentials This illustration Assumes that You Have Installed R and R-Studio If you have not already installed R and RStudio, please see: Windows
More informationExcel R Tips. is used for multiplication. + is used for addition. is used for subtraction. / is used for division
Excel R Tips EXCEL TIP 1: INPUTTING FORMULAS To input a formula in Excel, click on the cell you want to place your formula in, and begin your formula with an equals sign (=). There are several functions
More informationIntroduction to R. Hao Helen Zhang. Fall Department of Mathematics University of Arizona
Department of Mathematics University of Arizona hzhang@math.aricona.edu Fall 2019 What is R R is the most powerful and most widely used statistical software Video: A language and environment for statistical
More informationLECTURE NOTES FOR ECO231 COMPUTER APPLICATIONS I. Part Two. Introduction to R Programming. RStudio. November Written by. N.
LECTURE NOTES FOR ECO231 COMPUTER APPLICATIONS I Part Two Introduction to R Programming RStudio November 2016 Written by N.Nilgün Çokça Introduction to R Programming 5 Installing R & RStudio 5 The R Studio
More informationWeek 1: Introduction to R, part 1
Week 1: Introduction to R, part 1 Goals Learning how to start with R and RStudio Use the command line Use functions in R Learning the Tools What is R? What is RStudio? Getting started R is a computer program
More informationInstruction: Download and Install R and RStudio
1 Instruction: Download and Install R and RStudio We will use a free statistical package R, and a free version of RStudio. Please refer to the following two steps to download both R and RStudio on your
More informationPractical 4: The Integrate & Fire neuron
Practical 4: The Integrate & Fire neuron 2014 version by Mark van Rossum 2018 version by Matthias Hennig and Theoklitos Amvrosiadis 16th October 2018 1 Introduction to MATLAB basics You can start MATLAB
More informationIntroduction to Statistics using R/Rstudio
Introduction to Statistics using R/Rstudio R and Rstudio Getting Started Assume that R for Windows and Macs already installed on your laptop. (Instructions for installations sent) R on Windows R on MACs
More informationReading and wri+ng data
An introduc+on to Reading and wri+ng data Noémie Becker & Benedikt Holtmann Winter Semester 16/17 Course outline Day 4 Course outline Review Data types and structures Reading data How should data look
More informationIntroduction 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 informationTopics 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 informationActivity: page 1/10 Introduction to Excel. Getting Started
Activity: page 1/10 Introduction to Excel Excel is a computer spreadsheet program. Spreadsheets are convenient to use for entering and analyzing data. Although Excel has many capabilities for analyzing
More information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationStatistical Programming with R
Statistical Programming with R Lecture 9: Basic graphics in R Part 2 Bisher M. Iqelan biqelan@iugaza.edu.ps Department of Mathematics, Faculty of Science, The Islamic University of Gaza 2017-2018, Semester
More informationGS 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 informationIntroduction 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 informationDisplay Lists in grid
Display Lists in grid Paul Murrell April 13, 2004 A display list is a record of drawing operations. It is used to redraw graphics output when a graphics window is resized, when graphics output is copied
More informationDSCI 325: Handout 18 Introduction to Graphics in R
DSCI 325: Handout 18 Introduction to Graphics in R Spring 2016 This handout will provide an introduction to creating graphics in R. One big advantage that R has over SAS (and over several other statistical
More informationBasics 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 informationIntroduction to 3/15/2012. Poll Are You Sticking Around for Part 2? 1. Yes 2. No. Steve Berman, FCAS, MAAA Jim Guszcza, FCAS, MAAA
Introduction to CAS RPM Seminar March 19, 2012 Steve Berman, FCAS, MAAA Jim Guszcza, FCAS, MAAA Poll Are You Sticking Around for Part 2? 1. Yes 2. No 1 1 Poll How Much Do You Know About R? 1. Isn t that
More informationBjø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 informationShort 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 informationPackage Rwinsteps. February 19, 2015
Version 1.0-1 Date 2012-1-30 Title Running Winsteps in R Package Rwinsteps February 19, 2015 Author Anthony Albano , Ben Babcock Maintainer Anthony Albano
More informationAn 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 informationBarry Grant
Barry Grant bjgrant@umich.edu http://thegrantlab.org What is R? R is a freely distributed and widely used programing language and environment for statistical computing, data analysis and graphics. R provides
More informationLogical operators: R provides an extensive list of logical operators. These include
meat.r: Explanation of code Goals of code: Analyzing a subset of data Creating data frames with specified X values Calculating confidence and prediction intervals Lists and matrices Only printing a few
More informationControl 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 informationClass 2: Statistical computing using R (programming)
Class 2: Statistical computing using R (programming) You must read this chapter while sitting at the computer with an R window open. You will learn by typing in code from this chapter. You can learn further
More informationMatrix 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 informationDisplay Lists in grid
Display Lists in grid Paul Murrell December 14, 2009 A display list is a record of drawing operations. It is used to redraw graphics output when a graphics window is resized, when graphics output is copied
More informationStatistical Programming with R
(connorharris@college.harvard.edu) CS50, Harvard University October 27, 2015 If you want to follow along with the demos, download R at cran.r-project.org or from your Linux package manager What is R? Programming
More informationLab 1: Getting started with R and RStudio Questions? or
Lab 1: Getting started with R and RStudio Questions? david.montwe@ualberta.ca or isaacren@ualberta.ca 1. Installing R and RStudio To install R, go to https://cran.r-project.org/ and click on the Download
More informationTutorial (Unix Version)
Tutorial (Unix Version) S.f.Statistik, ETHZ February 26, 2010 Introduction This tutorial will give you some basic knowledge about working with R. It will also help you to familiarize with an environment
More informationfile:///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 informationAn Introduction to R Graphics
An Introduction to R Graphics PnP Group Seminar 25 th April 2012 Why use R for graphics? Fast data exploration Easy automation and reproducibility Create publication quality figures Customisation of almost
More informationTutorial: SeqAPass Boxplot Generator
1 Tutorial: SeqAPass Boxplot Generator 1. Access SeqAPASS by opening https://seqapass.epa.gov/seqapass/ using Mozilla Firefox web browser 2. Open the About link on the login page or upon logging in to
More informationIntroduction to R Reading, writing and exploring data
Introduction to R Reading, writing and exploring data R-peer-group QUB February 12, 2013 R-peer-group (QUB) Session 2 February 12, 2013 1 / 26 Session outline Review of last weeks exercise Introduction
More informationAn Introductory Guide to R
An Introductory Guide to R By Claudia Mahler 1 Contents Installing and Operating R 2 Basics 4 Importing Data 5 Types of Data 6 Basic Operations 8 Selecting and Specifying Data 9 Matrices 11 Simple Statistics
More informationGetting 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 informationIntroduction 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 informationPractical 1P1 Computing Exercise
Practical 1P1 Computing Exercise What you should learn from this exercise How to use the teaching lab computers and printers. How to use a spreadsheet for basic data analysis. How to embed Excel tables
More informationMATLAB Project: Getting Started with MATLAB
Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB built-in functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos,
More informationIntroduction 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 informationLab1: Use of Word and Excel
Dr. Fritz Wilhelm; physics 230 Lab1: Use of Word and Excel Page 1 of 9 Lab partners: Download this page onto your computer. Also download the template file which you can use whenever you start your lab
More informationTypes of Plotting Functions. Managing graphics devices. Further High-level Plotting Functions. The plot() Function
3 / 23 5 / 23 Outline The R Statistical Environment R Graphics Peter Dalgaard Department of Biostatistics University of Copenhagen January 16, 29 1 / 23 2 / 23 Overview Standard R Graphics The standard
More informationIntroduction to R gherardo varando
Introduction to R gherardo varando The R Software Environment As The R Project website states : and R is a free software environment for statistical computing and graphics. It compiles and runs on a wide
More informationMatlab Introduction. Scalar Variables and Arithmetic Operators
Matlab Introduction Matlab is both a powerful computational environment and a programming language that easily handles matrix and complex arithmetic. It is a large software package that has many advanced
More informationIntroduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices
Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are
More informationCLEANING DATA IN R. Type conversions
CLEANING DATA IN R Type conversions Types of variables in R character: "treatment", "123", "A" numeric: 23.44, 120, NaN, Inf integer: 4L, 1123L factor: factor("hello"), factor(8) logical: TRUE, FALSE,
More informationUnix Computer To open MATLAB on a Unix computer, click on K-Menu >> Caedm Local Apps >> MATLAB.
MATLAB Introduction This guide is intended to help you start, set up and understand the formatting of MATLAB before beginning to code. For a detailed guide to programming in MATLAB, read the MATLAB Tutorial
More informationMATLAB 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 informationGetting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text
Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go
More informationA brief introduction to R
A brief introduction to R Cavan Reilly September 29, 2017 Table of contents Background R objects Operations on objects Factors Input and Output Figures Missing Data Random Numbers Control structures Background
More informationMAT 343 Laboratory 4 Plotting and computer animation in MATLAB
MAT 4 Laboratory 4 Plotting and computer animation in MATLAB In this laboratory session we will learn how to. Plot in MATLAB. The geometric properties of special types of matrices (rotations, dilations,
More informationThe Mathcad Workspace 7
For information on system requirements and how to install Mathcad on your computer, refer to Chapter 1, Welcome to Mathcad. When you start Mathcad, you ll see a window like that shown in Figure 2-1. By
More informationDemo yeast mutant analysis
Demo yeast mutant analysis Jean-Yves Sgro February 20, 2018 Contents 1 Analysis of yeast growth data 1 1.1 Set working directory........................................ 1 1.2 List all files in directory.......................................
More informationThe nor1mix Package. June 12, 2007
The nor1mix Package June 12, 2007 Title Normal (1-d) Mixture Models (S3 Classes and Methods) Version 1.0-7 Date 2007-03-15 Author Martin Mächler Maintainer Martin Maechler
More informationUsing 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 informationConstraint-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 informationLecture 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 informationThe nor1mix Package. August 3, 2006
The nor1mix Package August 3, 2006 Title Normal (1-d) Mixture Models (S3 Classes and Methods) Version 1.0-6 Date 2006-08-02 Author: Martin Mächler Maintainer Martin Maechler
More informationITS 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 informationGetting 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 informationR 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 informationIntermediate Programming in R Session 1: Data. Olivia Lau, PhD
Intermediate Programming in R Session 1: Data Olivia Lau, PhD Outline About Me About You Course Overview and Logistics R Data Types R Data Structures Importing Data Recoding Data 2 About Me Using and programming
More information7 Control Structures, Logical Statements
7 Control Structures, Logical Statements 7.1 Logical Statements 1. Logical (true or false) statements comparing scalars or matrices can be evaluated in MATLAB. Two matrices of the same size may be compared,
More informationLaboratory 1 Octave Tutorial
Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory
More information> glucose = c(81, 85, 93, 93, 99, 76, 75, 84, 78, 84, 81, 82, 89, + 81, 96, 82, 74, 70, 84, 86, 80, 70, 131, 75, 88, 102, 115, + 89, 82, 79, 106)
This document describes how to use a number of R commands for plotting one variable and for calculating one variable summary statistics Specifically, it describes how to use R to create dotplots, histograms,
More informationComputing With R Handout 1
Computing With R Handout 1 Getting Into R To access the R language (free software), go to a computing lab that has R installed, or a computer on which you have downloaded R from one of the distribution
More information