Sébastien Lê Agrocampus Rennes A very short introduction to “R” The “Rcmdr” package and its environment.

Slides:



Advertisements
Similar presentations
Using R with Python.
Advertisements

Introduction to R Brody Sandel. Topics Approaching your analysis Basic structure of R Basic programming Plotting Spatial data.
R for Macroecology Aarhus University, Spring 2011.
Training on R For 3 rd and 4 th Year Honours Students, Dept. of Statistics, RU Empowered by Higher Education Quality Enhancement Project (HEQEP) Department.
R tutorial g/methods2.2010/R-intro.pdf.
Statistical Software An introduction to Statistics Using R Instructed by Jinzhu Jia.
Basics of Using R Xiao He 1. AGENDA 1.What is R? 2.Basic operations 3.Different types of data objects 4.Importing data 5.Basic data manipulation 2.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTION Lesson 1 – Microsoft Office XP Basics and the Internet.
Introduction to GTECH 201 Session 13. What is R? Statistics package A GNU project based on the S language Statistical environment Graphics package Programming.
R for Research Data Analysis using R Day1: Basic R Baburao Kamble University of Nebraska-Lincoln.
An introduction to R Honors 207 Cognitive Science (These Slides were Shamelessly Stolen from Dr. Pablo Gomez, DePaul University)
A Simple Guide to Using SPSS© for Windows
R – a brief introduction Johannes Freudenberg Cincinnati Children’s Hospital Medical Center
R – a brief introduction Johannes Freudenberg Cincinnati Children’s Hospital Medical Center
EViews. Agenda Introduction EViews files and data Examining the data Estimating equations.
SPSS 1: An Introduction to the Statistical Package SPSS Suzie Cro MRC Clinical Trials Unit.
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.
SPSS Statistical Package for the Social Sciences is a statistical analysis and data management software package. SPSS can take data from almost any type.
Training on R-language Mārtiņš Liberts Central Statistical Bureau of Latvia.
Introduction to R: The Basics Rosales de Veliz L., David S.L., McElhiney D., Price E., & Brooks G. Contributions from Ragan. M., Terzi. F., & Smith. E.
Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week2: Data Structure, Types and Manipulation in R.
Introduction to R Statistical Software Anthony (Tony) R. Olsen USEPA ORD NHEERL Western Ecology Division Corvallis, OR (541)
Applied Bioinformatics Introduction to Linux and R Bing Zhang Department of Biomedical Informatics Vanderbilt University
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
TrendReader Standard 2 This generation of TrendReader Standard software utilizes the more familiar Windows format (“tree”) views of functions and file.
R – a brief introduction Statistical physics – lecture 11 Szymon Stoma.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Carolina Environmental Program UNC Chapel Hill The Analysis Engine – A New Tool for Model Evaluation, Sensitivity and Uncertainty Analysis, and more… Alison.
732A44 Programming in R.  Self-studies of the course book  2 Lectures (1 in the beginning, 1 in the end)  Labs (computer). Compulsory submission of.
Data, graphics, and programming in R 28.1, 30.1, Daily:10:00-12:45 & 13:45-16:30 EXCEPT WED 4 th 9:00-11:45 & 12:45-15:30 Teacher: Anna Kuparinen.
A B C Q R S! Coilín Minto Department of Biology, Dalhousie University.
Maximum Likelihood Estimates and the EM Algorithms I Henry Horng-Shing Lu Institute of Statistics National Chiao Tung University
Arko Barman with modification by C.F. Eick COSC 4335 Data Mining Spring 2015.
Math 15 Lecture 7 University of California, Merced Scilab A “Very” Short Introduction.
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.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
BINF634 - Perl and R1 BINF634 Perl and R. BINF634 - Perl and R2 Some R References The R Book by Michael J. Crawley The R Book Statistics An Introduction.
R Programming Yang, Yufei. Normal distribution.
ELECTRONIC SPREADSHEATS ELECTRONIC SPREADSHEATS Chapter 14 Dr. Bahaa Al-Sheikh & Eng. Mohammed AlSumady Intoduction to Engineering BME152.
Introduction to R. Why use R Its FREE!!! And powerful, fairly widely used, lots of online posts about it Uses S -> an object oriented programing language.
Maximum Likelihood Estimates and the EM Algorithms I Henry Horng-Shing Lu Institute of Statistics National Chiao Tung University
R packages/libraries Data input/output Rachel Carroll Department of Public Health Sciences, MUSC Computing for Research I, Spring 2014.
Introduction to MATLAB Session 1 Simopekka Vänskä, THL 2010.
An Introduction to R Statistical Computing AMS 597 Stony Brook University Spring 2009 By Tianyi Zhang.
Introduction to R Introductions What is R? RStudio Layout Summary Statistics Your First R Graph 17 September 2014 Sherubtse Training.
Scientific Computing (w1) R Computing Workshops An Introduction to Scientific Computing workshop 1.
STAT 534: Statistical Computing Hari Narayanan
© 2015 by Wade Rogers Introduction to R Cytomics Workshop December, 2015.
To play, start slide show and click on circle Lesson 1 Lesson 1 Lesson 2 Lesson 2 Lesson Lesson 3.
Introductory Data Analysis F73DA2. Contact Times (Spring Term 2008) Monday 4: : Lecture in LT3 Tuesday 2: : Lecture in LT3 Wednesday
Descriptive Statistics using R. Summary Commands An essential starting point with any set of data is to get an overview of what you are dealing with You.
Review > x[-c(1,4,6)] > Y[1:3,2:8] > island.data fishData$weight[1] > fishData[fishData$weight < 20 & fishData$condition.
16BIT IITR Data Collection Module If you have not already done so, download and install R from download.
Working with data in R 2 Fish 552: Lecture 3. Recommended Reading An Introduction to R (R Development Core Team) –
Arko Barman COSC 6335 Data Mining Fall  Free, open source statistical analysis software  Competitor to commercial softwares like MATLAB and SAS.
R Brown-Bag Seminar 2.1 Topic: Introduction to R Presenter: Faith Musili ICRAF-Geoscience Lab.
Programming in R Intro, data and programming structures
R basics workshop Sohee Kang Math and Stats Learning Centre
R programming language
Introduction to R Samal Dharmarathna.
Arko Barman COSC 6335 Data Mining Fall 2014
Naomi Altman Department of Statistics (Based on notes by J. Lee)
Introduction to R Studio
MATLAB DENC 2533 ECADD LAB 9.
Lab 1 Introductions to R Sean Potter.
Introduction to R.
Code is on the Website Outline Comparison of Excel and R
Statistics 540 Computing in Statistics
Introduction to Matlab
MIS2502: Data Analytics Introduction to R and RStudio
Presentation transcript:

Sébastien Lê Agrocampus Rennes A very short introduction to “R” The “Rcmdr” package and its environment

Introduction to R and to the Rcmdr package2 What R is and what it is not R is –a programming language –a statistical package –an interpreter –Open Source R is not –a database –a collection of “black boxes” –a spreadsheet software package –commercially supported

Introduction to R and to the Rcmdr package3 Getting started To obtain and install R on your computer 1)Go to to choose a mirror near youhttp://cran.r-project.org/mirrors.html 2)Click on your favorite operating system (Linux, Mac, or Windows) 3)Download and install the “base” To install additional packages 1)Start R on your computer 2)Choose the appropriate item from the “Packages” menu

Introduction to R and to the Rcmdr package4 R as a calculator R can be used as a calculator: > 5 + (6 + 7) * pi^2 [1] > log(exp(1)) [1] 1 > log(1000, 10) [1] 3 > sin(pi/3)^2 + cos(pi/3)^2 [1] 1 > Sin(pi/3)^2 + cos(pi/3)^2 Error: couldn't find function "Sin"

Introduction to R and to the Rcmdr package5 Basic data types Logical > x <- T; y <- F > x; y [1] TRUE [1] FALSE Numerical > a <- 5; b <- sqrt(2) > a; b [1] 5 [1] Character > a <- "1"; b <- 1 > a; b [1] "1" [1] 1 > a <- "character" > b <- "a"; c <- a > a; b; c [1] "character" [1] "a" [1] "character"

Introduction to R and to the Rcmdr package6 Vectors, Matrices, Arrays Vector –Ordered collection of data of the same data type –Example: Last names of all students in this class Scores given by a panelist on a set of products –In R, single number is a vector of length 1 Matrix –Rectangular table of data of the same type –Example Scores given by all the panelists on a set of products (products=rows, panelists=columns) Array –Higher dimensional matrix (i.e. “multiway”)

Introduction to R and to the Rcmdr package7 Vectors Vector: Ordered collection of data of the same data type > x <- c(5.2, 1.7, 6.3) > log(x) [1] > y <- 1:5 > z <- seq(1, 1.4, by = 0.1) > y + z [1] > length(y) [1] 5 > mean(y + z) [1] 4.2

Introduction to R and to the Rcmdr package8 Matrices Matrix: Rectangular table of data of the same type > m <- matrix(1:12, 4, byrow = T); m [,1] [,2] [,3] [1,] [2,] [3,] [4,] > y <- -1:2 > m.new <- m + y > t(m.new) [,1] [,2] [,3] [,4] [1,] [2,] [3,] > dim(m) [1] 4 3 > dim(t(m.new)) [1] 3 4

Introduction to R and to the Rcmdr package9 Missing values R is designed to handle statistical data and therefore predestined to deal with missing values Numbers that are “not available” > x <- c(1, 2, 3, NA) > x + 3 [1] NA “Not a number” > log(c(0, 1, 2)) [1] -Inf > 0/0 [1] NaN

Introduction to R and to the Rcmdr package10 Subsetting It is often necessary to extract a subset of a vector or matrix R offers a couple of neat ways to do that > x <- c("a", "b", "c", "d", "e", "f", "g", "h") > x[1] > x[3:5] > x[-(3:5)] > x[c(T, F, T, F, T, F, T, F)] > x[x <= "d"] > m[,2] > m[3,]

Introduction to R and to the Rcmdr package11 Other Objects and Data Types Functions Factors Lists Data frames We’ll talk about them later in the course

Introduction to R and to the Rcmdr package12 Importing/Exporting Data Importing data –R can import data from other applications –The easiest way is to import tab delimited files > myData<-read.table("file",sep=",") > myData <- read.table(file = "C:/myFile.txt", header = TRUE, quote = "", sep = "\t", comment.char="") Exporting data –R can also export data in various formats –Tab delimited is the most common > write.table(x, "filename")

Introduction to R and to the Rcmdr package13 Analyzing/Summarizing data First, let’s take a look… > SimpleData[1:10,] Mean, Variance, Standard deviation, etc. > mean(SimpleData[,3]) > mean(log(SimpleData[,3])) > var(SimpleData[,4]) > sd(SimpleData[,3]) > cor(SimpleData[,3:4]) > colMeans(SimpleData[3:14])

Introduction to R and to the Rcmdr package14 Plotting Scatter plot > plot(log(SimpleData[,"C1"]), log(SimpleData[,"W1"]), xlab = "channel 1", ylab = "channel 2") Histogram > hist(log(SimpleData[,7])) > hist(log(SimpleData[,7]),nclass = 50, main = "Histogram of W3 (on log scale)") Boxplot > boxplot(log(SimpleData[,3:14])) > boxplot(log(SimpleData[,3:14]), outline = F, boxwex = 0.5, col = 3, main = "Boxplot of SimpleData")

Introduction to R and to the Rcmdr package15 Getting help… and quitting Getting information about a specific command > help(rnorm) > ?rnorm Finding functions related to a key word > help.search("boxplot") Starting the R installation help pages > help.start() Quitting R > q()

Introduction to R and to the Rcmdr package16 The Rcmdr package To load the Rcmdr package > library(Rcmdr)