Introduction to GTECH 201 Session 13. What is R? Statistics package A GNU project based on the S language Statistical environment Graphics package Programming.

Slides:



Advertisements
Similar presentations
2.3 Modeling Real World Data with Matrices
Advertisements

MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
 Statistics package  Graphics package  Programming language  Can be used to share/reproduce analyses  Many new packages being created - can be downloaded.
 2005 Pearson Education, Inc. All rights reserved Introduction.
An introduction to R Honors 207 Cognitive Science (These Slides were Shamelessly Stolen from Dr. Pablo Gomez, DePaul University)
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
Alternative text for elementary statistics –Elementary Concepts –Basic Statistics.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Lecture 2 MATLAB fundamentals Variables, Naming Rules, Arrays (numbers, scalars, vectors, matrices), Arithmetical Operations, Defining and manipulating.
Module 6 Matrices & Applications Chapter 26 Matrices and Applications I.
How to Use the R Programming Language for Statistical Analyses Part I: An Introduction to R Jennifer Urbano Blackford, Ph.D. Department of Psychiatry Kennedy.
End Show Introduction to Electronic Spreadsheets Unit 3.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Database Design IST 7-10 Presented by Miss Egan and Miss Richards.
Basic R Programming for Life Science Undergraduate Students Introductory Workshop (Session 1) 1.
Chapter 10 Review: Matrix Algebra
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Outline Variables 1.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Programming in R Getting data into R. Importing data into R In this session we will learn: Some basic R commands How to enter data directly into R How.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
Session 3: More features of R and the Central Limit Theorem Class web site: Statistics for Microarray Data Analysis.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
259 Lecture 13 Spring 2013 Advanced Excel Topics – Arrays.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Input, Output, and Processing
Piotr Wolski Introduction to R. Topics What is R? Sample session How to install R? Minimum you have to know to work in R Data objects in R and how to.
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Hands-on Introduction to R. We live in oceans of data. Computers are essential to record and help analyse it. Competent scientists speak C/C++, Java,
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
1 Data Structures CSCI 132, Spring 2014 Lecture 32 Tables I.
R packages/libraries Data input/output Rachel Carroll Department of Public Health Sciences, MUSC Computing for Research I, Spring 2014.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Working with Arrays in MATLAB
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Scientific Computing (w1) R Computing Workshops An Introduction to Scientific Computing workshop 1.
MATLAB for Engineers, by Holly Moore. ISBN © 2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is.
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
© 2015 by Wade Rogers Introduction to R Cytomics Workshop December, 2015.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
CMPS 1371 Introduction to Computing for Engineers VECTORS.
R objects  All R entities exist as objects  They can all be operated on as data  We will cover:  Vectors  Factors  Lists  Data frames  Tables 
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Manipulating MATLAB Vector, Matrices 1. Variables and Arrays What are variables? You name the variables (as the programmer) and assign them numerical.
An Introduction to Programming in Matlab Emily Blumenthal
1-2 What is the Matlab environment? How can you create vectors ? What does the colon : operator do? How does the use of the built-in linspace function.
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
Basic Elements of C++.
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
Basic Elements of C++ Chapter 2.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Communication and Coding Theory Lab(CS491)
funCTIONs and Data Import/Export
CSCI N317 Computation for Scientific Applications Unit R
R Course 1st Lecture.
Presentation transcript:

Introduction to GTECH 201 Session 13

What is R? Statistics package A GNU project based on the S language Statistical environment Graphics package Programming language

Getting Started Starting R

Getting Help Getting help > help ( ) provides help on how to use ‘help’ > help (topic) provides help on a specific topic > help.start ( ) brings you to a web interface to the R documentation

R functions take arguments (information that you put into the function which goes between the brackets) and can perform a range of tasks. In the case of the ‘help’ function the task is to display information from the R documentation files. R Functions help ( ) is an R function

R as Calculator R will evaluate basic calculations which you type into the console (input window)

Assigning Values With the <- operator With a regular = equal sign

R as Calculator In the previous example x and y are variables. We obtained the sum of x and y by typing x + y In the same way we could carry out much more complicated calculations Generally you can obtain the number (or other value) stored in any letter by typing the letter followed by enter (or by typing print (letter) or show (letter))

Simple Operations Add Multiply10 * 20 Divide10 / 20 Raise to a power10 ** 20 Modulo10 %/% 20 Integer division10 % 4

In R you can think of vectors as being equivalent to a single column of numbers. You can create a vector using the c( ) function as follows: x <- c( ) e.g. x <- c(1,2,4,8) creates a column of the numbers 1,2,4,8 Vectors

When you carry out simple operations (+ - * /) on vectors in R that have the same number of entries R just performs the normal operations on the numbers in the vector entry by entry If the vectors don’t have the same number of entries then R will cycle through the vector with the smaller number of entries Vectors can be assigned by putting together other vectors Simple Operations on Vectors

Combining Vectors

Matrices and Lists Matrix Rectangular table of data of the same type Arrays are 3-, 4-,.. n-dimensional matrices List An ordered collection of data of arbitrary types > doe = list(name="john",age=28,married=F)

Data Frames The tables we know from Excel Each column has the same type But different columns may be of different type

Subsetting Individual elements of a vector, matrix, array or data frame are accessed with “[ ]” by specifying their index, or their name

Storing Data Every R object can be stored into and restored from a file with the commands “save” and “load” > save(x, file=“x.Rdata”) > load(“x.Rdata”)

R Import and Export Most programs (e.g. Excel) know how to deal with rectangular tables in the form of tab-delimited text files > x = read.delim(“filename.txt”) also: read.table, read.csv > write.table(x, file=“x.txt”, sep=“\t”)

Importing Data Caveats Type conversions The read functions try to guess and autoconvert the data types of the different columns (e.g. number, factor, character) Special characters Delimiter character (space, comma, tabulator) cannot be part of a data field To circumvent this, text may be “quoted”

Getting Help (Again) Html search engine