Example of multivariate data What is R? R is available as Free Software under the terms of the Free Software Foundation'sFree Software Foundation GNU General.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Introduction to arrays
Variables 9/10/2013. Readings Chapter 3 Proposing Explanations, Framing Hypotheses, and Making Comparisons (Pollock) (pp.48-58) Chapter 1 Introduction.
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.
Experiences in Integration of the 'R' System into Kepler Dan Higgins – National Center for Ecological Analysis and Synthesis (NCEAS), UC Santa Barbara.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Microarray Analysis Jesse Mecham CS 601R. Microarray Analysis It all comes down to Experimental Design Experimental Design Preprocessing Preprocessing.
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.
LISA Short Course Series R Basics
What is R Muhammad Omer. What is R  R is the programing language software for statistical computing and data analysis  The R language is extensively.
Training on R-language Mārtiņš Liberts Central Statistical Bureau of Latvia.
Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week2: Data Structure, Types and Manipulation in R.
LISA Short Course Series Basics of R Lin Zhang Feb. 16, 2015 LISA: Basics of RFeb. 16, 2015.
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
What is R By: Wase Siddiqui. Introduction R is a programming language which is used for statistical computing and graphics. “R is a language and environment.
Basic R Programming for Life Science Undergraduate Students Introductory Workshop (Session 1) 1.
1 An Introduction – UCF, Methods in Ecology, Fall 2008 An Introduction By Danny K. Hunt & Eric D. Stolen Getting Started with R (with speaker notes)
LISA Short Course Series R Basics Ana Maria Ortega Villa Fall 2013 LISA: R BasicsFall 2013.
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.
Hands-on Introduction to R. Outline R : A powerful Platform for Statistical Analysis Why bother learning R ? Data, data, data, I cannot make bricks without.
Introduction to SPSS Edward A. Greenberg, PhD
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.
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
Data Objects in R Vector1 dimensionAll elements have the same data types Data types: numeric, character logic, factor Matrix2 dimensions Array2 or more.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
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.
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,
R Programming Yang, Yufei. Normal distribution.
Introduction to Programming in R Department of Statistical Sciences and Operations Research Computation Seminar Series Speaker: Edward Boone
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
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.
Performing statistical analyses using the Rshell processor Original material by Peter Li, University of Birmingham, UK Adapted by Norman.
Introduction to R Carol Bult The Jackson Laboratory Functional Genomics (BMB550) Spring 2011.
STAT 534: Statistical Computing Hari Narayanan
DTC Quantitative Methods Summary of some SPSS commands Weeks 1 & 2, January 2012.
© 2015 by Wade Rogers Introduction to R Cytomics Workshop December, 2015.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
R Roger Barlow HEP Computing seminar 21 st February 2008.
Basics in R part 2. Variable types in R Common variable types: Numeric - numeric value: 3, 5.9, Logical - logical value: TRUE or FALSE (1 or 0)
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
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.
Introduction to R and Data Science Tools in the Microsoft Stack Jamey Johnston.
Basics of R INSTRUCTOR: AMANDA MCGOUGH TUESDAY, MARCH 29, 2016.
MIS2502: Data Analytics Introduction to Advanced Analytics and R.
Introduction to R Chris Free. Introduction to R Free! Superior (if not comparable) to commercial alternatives Available on all platforms Not just for.
16BIT IITR Data Collection Module If you have not already done so, download and install R from download.
Introduction to R and Data Science Tools in the Microsoft Stack Jamey Johnston.
Introduction to R Dr. Satish Nargundkar. What is R? R is a free software environment for statistical computing and graphics. It compiles and runs on a.
Introduction to R.
Introduction to R and Data Science Tools in the Microsoft Stack
Introduction to R and Data Science Tools in the Microsoft Stack
Programming in R Intro, data and programming structures
Introduction to R Samal Dharmarathna.
Second Annual Cytomics Workshop April, 2017
Introduction to R Carolina Salge March 29, 2017.
Introduction Osborn.
R Programming.
IE-432 Design Of Industrial Experiments
Lab 1 Introductions to R Sean Potter.
Introduction to R.
Installing Packages Introduction to R, Part II
Analytics vs Statistics the problem is…
Stat 251 (2009, Summer) Lab 1 TA: Yu, Chi Wai.
Programming For Big Data
R Course 1st Lecture.
Presentation transcript:

Example of multivariate data What is R? R is available as Free Software under the terms of the Free Software Foundation'sFree Software Foundation GNU General Public LicenseGNU General Public License in source code form. It compiles and runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux),Windows and MacOS. R can be extended (easily) via packages. There are about eight packages supplied with the R distribution and many more are available through the CRAN family of Internet sites covering a very wide range of modern statistics. R is a language and environment for statistical computing and graphics.

Example of multivariate data The R environment A fully planned and coherent system that includes: an effective data handling and storage facility, a suite of operators for calculations on arrays (matrices), a large, coherent, integrated collection of intermediate tools for data analysis, graphical facilities for data analysis and display (on-screen or on hardcopy), a well-developed, simple and effective programming languages which includes conditionals, loops, user-defined recursive functions and input and output facilities. R for free at:

Exam of multivariate data R Download

Exam of multivariate data R Download

Exam of multivariate data R Download

Exam of multivariate data R packages

Exam of multivariate data R Console

Exam of multivariate data Import data in R

Exam of multivariate data Import data in R

Exam of multivariate data Install packages

Exam of multivariate data Install packages

Exam of multivariate data Install packages

Exam of multivariate data R script

Exam of multivariate data R script

Exam of multivariate data RStudio

Exam of multivariate data RStudio

Example of multivariate data Import data in RStudio

Exam of multivariate data Install packages in RStudio

Exam of multivariate data R in linux

Exam of multivariate data R in linux

Essential commands in R

Example Vectors in R # Character vector: > c("Huey","Dewey","Louie") [1] "Huey" "Dewey" "Louie" # Logical vector: > c(T,T,F,T) [1] TRUE TRUE FALSE TRUE # Numeric vector: > c(2,3,5,7,9) [1] #Functions that create vectors: c-“concatenate” seq-”sequence” rep-”replicate” > c(42,57,12,39) [1] > seq(4,9) [1] > rep(1:2,5) [1] > rep(1:2,c(3,4)) [1]

Example Factors in R Factors – a data structure that makes it possible to assign meaningful names to the categories. > pain=c(0,3,2,2,1) > fpain=factor(pain,levels=0:3) > levels(fpain)=c("none","mild","medium","severe") > fpain [1] none severe medium medium mild Levels: none mild medium severe > levels(fpain) [1] "none" "mild" "medium" "severe"

Example Matrices and arrays > x=1:2 > x=1:12 > dim(x)=c(3,4) > x [,1] [,2] [,3] [,4] [1,] [2,] [3,] > x=matrix(1:12,nrow=3,byrow=T) > rownames(x)=LETTERS[1:3] > x [,1] [,2] [,3] [,4] A B C > t(x) A B C [1,] [2,] [3,] [4,] LETTERS- build in variable that contains the capital letters A-Z. t(x) – the transpose matrix of x.

Example Matrices and arrays > cbind(A=1:4,B=5:8,C=9:12) A B C [1,] [2,] [3,] [4,] > rbind(A=1:4,B=5:8,C=9:12) [,1] [,2] [,3] [,4] A B C # Use the functions cbind and rbind to “bind” vectors together columnwise or rowwise.

Example Data frames Data frame – it is a list of vectors and/or factors of the same length, which are related “across”, such that data in the same position come from the same experimental unit (subject, animal, etc.). > conc=c(5,12,20,24,35,40) > vol=c(20,25,33,40,50,55) > d=data.frame(conc,vol) > d conc vol

Example of multivariate data Data manipulation in R Data: “Soil” Soil properties of two adjacent locations on Wimbledon common, a sandy lowland heath (site1), and adjoining spoil mounds of calcareous clay (site 2). Parameters: Site - site number rep - quadrat replicate number pH cond - electrical conductivity of soil solution OM - percentage organic matter composition of soil H2O – percentage water content of soil after drying to 105°F

Example of multivariate data Read data in R >Soil=read.csv("E:/Multivariate_analysis/Data/Soil.csv",header=T) > Soil Site rep pH cond OM H2O NA NA A comment in R is marked with # #import a.text file: > Soil=read.table("E:/Multivariate_analysis/Data/Soil.txt",header=T) #import a.csv file:

Example of multivariate data Data manipulation in R > names(Soil) [1] "Site" "rep" "pH" "cond" "OM" "H2O" #Display the column names of “Soil” data: #Display the row names: > rownames(Soil) [1] "1" "2" "3" "4" "5" "6" "7" "8" #Display the dimensions of the Soil data: > dim(Soil) [1] 8 6 rows (observations) columns (variables)

Example of multivariate data Data manipulation in R #Select the second column of the data: #or: #Select the third row of the data: > Soil[,2] [1] > Soil$rep [1] >Soil[3,] Site rep pH cond OM H2O #Select rows 2,4, and 5: > Soil[c(2,4,5),] Site rep pH cond OM H2O

Example of multivariate data Data manipulation in R #Display the length of the second column: #Add a new column log.pH containing the logarithmic transform of pH: > length(Soil[,2]) [1] 8 >Soil2=transform(Soil,log.pH=log(Soil$pH)) > Soil2 Site rep pH cond OM H2O log.pH NA NA

Example of multivariate data Data manipulation in R #Delete the third column (pH) of the “Soil2” data: > Soil3=Soil2[,-3] > Soil3 Site rep cond OM H2O log.pH NA NA

Example of multivariate data Data manipulation in R #Select the first four columns of the “Soil” data: > Soil4=Soil[,1:4] > Soil4 Site rep pH cond

Example of multivariate data Data manipulation in R #Obtain a subset of the “Soil” data with cond >100: > Soil5=subset(Soil,Soil$cond>100) > Soil5 Site rep pH cond OM H2O NA #Obtain a subset of the “Soil” data with cond >100 and H2O<32 >Soil6=subset(Soil,Soil$cond>100&Soil$H2O<32) > Soil6 Site rep pH cond OM H2O

Example of multivariate data Data manipulation in R #Obtain a subset of the “Soil” data with no missing values (NA): > Soil7=subset(Soil, !is.na(Soil$OM)) > Soil7 Site rep pH cond OM H2O #Obtain a subset of the “Soil” data with missing values (NA): > Soil8=subset(Soil,is.na(Soil$OM)) > Soil8 Site rep pH cond OM H2O NA NA 35

Example of multivariate data Data manipulation in R #Identify which observations have pH<7: > which(Soil$pH<7) [1] # observations (rows) 1,2,3,and 4 have pH<7. #Identify which observations have missing values for OM: > which(is.na(Soil$OM)) [1] 3 6 #observations 3 and 6 have missing values for OM. #Identify which observation has pH=5.4: > which(Soil$pH==5.4) [1] 2 > which(Soil$Site!=1) [1] #Identify which observations are not from the Site 1:

Example of multivariate data Data manipulation in R #Order “Soil” data by pH: > Soil9=Soil[order(Soil$pH),] > Soil9 Site rep pH cond OM H2O NA NA 35 > Soil10=Soil[order(-Soil$pH),] > Soil10 Site rep pH cond OM H2O NA NA Increasing Decreasing

Example of multivariate data Data manipulation in R #Save “Soil10” data from the R console to your computer: >write.table(Soil10,file="E:/Multivariate_analysis/pH_Order_Soil.csv“, row.names=F,col.names=names(Soil10),quote=F,sep=",") #Load a package in R (after installing it): > library(MASS)# load the package called MASS # Get help with R functions: >help(read.table) >?read.table or

Example of multivariate data Get help in R

Example of multivariate data Simple summary statistics #Calculate mean, standard deviation, variance, median, sum, and maximum and minimum values for “cond” in “Soil” data: > mean(Soil$cond) [1] > sd(Soil$cond) [1] > var(Soil$cond) [1] > median(Soil$cond) [1] 92 > sum(Soil$cond) [1] 805 > max(Soil$cond) [1] 166 > min(Soil$cond) [1] 49

Example of multivariate data Graphics in R

Example of multivariate data Graphics in R