INTRODUCTION TO R. Basic Graphics

Size: px
Start display at page:

Download "INTRODUCTION TO R. Basic Graphics"

Transcription

1 INTRODUCTION TO R Basic Graphics

2 Graphics in R Create plots with code Replication and modification easy Reproducibility! graphics package ggplot2, ggvis, lattice

3 graphics package Many functions plot() and hist() plot() Generic Different inputs -> Different plots Vectors, linear models, kernel densities

4 countries > str(countries) 'data.frame': 194 obs. of 5 variables: $ name : chr "Afghanistan" "Albania" "Algeria"... $ continent : Factor w/ 6 levels "Africa","Asia",... $ area : int $ population: int $ religion : Factor w/ 6 levels "Buddhist","Catholic"...

5 plot() (categorical) > plot(countries$continent)

6 plot() (numerical) > plot(countries$population)

7 plot() (2x numerical) > plot(countries$area, countries$population)

8 plot() (2x numerical) > plot(log(countries$area), log(countries$population))

9 plot() (2x categorical) > plot(countries$continent, countries$religion)

10 plot() (2x categorical) x axis (horizontal) y axis (vertical) > plot(countries$religion, countries$continent)

11 hist() Short for histogram Visual representation of distribution Bin all values Plot frequency of bins

12 hist() > africa_obs <- countries$continent == "Africa" > africa <- countries[africa_obs, ]

13 hist() > hist(africa$population)

14 hist() > hist(africa$population, breaks = 10)

15 Other graphics functions barplot() boxplot() pairs()

16 INTRODUCTION TO R Let s practice!

17 INTRODUCTION TO R Customizing Plots

18 mercury > mercury temperature pressure

19 Basic plot > plot(mercury$temperature, mercury$pressure)

20 Fancy plot > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", horizontal axis label ylab = "Pressure", vertical axis label main = "T vs P for Mercury", plot title type = "o", plot type col = "orange")

21 Fancy plot > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", horizontal axis label ylab = "Pressure", vertical axis label main = "T vs P for Mercury", plot title type = "l", plot type col = "orange") plot color

22 Graphical Parameters > plot(mercury$temperature, mercury$pressure, col = "darkgreen")

23 Graphical Parameters > plot(mercury$temperature, mercury$pressure)

24 par() >?par > par() List of 72 $ xlog : logi FALSE $ ylog : logi FALSE $ adj : num $ fin : num [1:2] $ font : int 1 $ font.axis: int 1 $ font.lab : int 1... $ yaxs : chr "r" $ yaxt : chr "s" $ ylbias : num 0.2

25 par() > par(col = "blue") > plot(mercury$temperature, mercury$pressure)

26 par() > par(col = "blue") > plot(mercury$temperature, mercury$pressure) > plot(mercury$pressure, mercury$temperature) > par()$col [1] "blue"

27 More graphical parameters > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", ylab = "Pressure", main = "T vs P for Mercury", type = "o", col = "orange", col.main = "darkgray", cex.axis = 0.6, lty = 5, pch = 4)

28 More graphical parameters > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", ylab = "Pressure", main = "T vs P for Mercury", type = "o", col = "orange", col.main = "darkgray", cex.axis = 0.6, lty = 5, pch = 4)

29 More graphical parameters > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", ylab = "Pressure", main = "T vs P for Mercury", type = "o", col = "orange", col.main = "darkgray", cex.axis = 0.6, lty = 5, pch = 4)

30 More graphical parameters > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", ylab = "Pressure", main = "T vs P for Mercury", type = "o", col = "orange", col.main = "darkgray", cex.axis = 1.5, lty = 5, pch = 4)

31 lty: Line Type > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", ylab = "Pressure", main = "T vs P for Mercury", type = "o", col = "orange", col.main = "darkgray", cex.axis = 1.5, lty = 5, pch = 4)

32 pch: Plot Symbol > plot(mercury$temperature, mercury$pressure, xlab = "Temperature", ylab = "Pressure", main = "T vs P for Mercury", type = "o", col = "orange", col.main = "darkgray", cex.axis = 1.5, lty = 5, pch = 4)

33 INTRODUCTION TO R Let s practice!

34 INTRODUCTION TO R Multiple Plots

35 Graphics so far Plot single source of data No combinations of plots No different layers

36 shop > str(shop) 'data.frame': 27 obs. of 5 variables: $ sales : num $ ads : num $ comp : int $ inv : int $ size_dist: num

37 mfrow parameter in par() > par() List of 72 $ xlog : logi FALSE $ ylog : logi FALSE $ adj : num $ fin : num [1:2] $ font : int 1 $ font.axis: int 1 $ font.lab : int 1... $ yaxs : chr "r" $ yaxt : chr "s" $ ylbias : num 0.2

38 mfrow parameter > par(mfrow = c(2,2)) > plot(shop$ads, shop$sales)

39 mfrow parameter > par(mfrow = c(2,2)) > plot(shop$ads, shop$sales) > plot(shop$comp, shop$sales)

40 mfrow parameter > par(mfrow = c(2,2)) > plot(shop$ads, shop$sales) > plot(shop$comp, shop$sales) > plot(shop$inv, shop$sales)

41 mfrow parameter > par(mfrow = c(2,2)) > plot(shop$ads, shop$sales) > plot(shop$comp, shop$sales) > plot(shop$inv, shop$sales) > plot(shop$size_dist, shop$sales)

42 mfcol parameter > par(mfcol = c(2,2)) > plot(shop$ads, shop$sales)

43 mfcol parameter > par(mfcol = c(2,2)) > plot(shop$ads, shop$sales) > plot(shop$comp, shop$sales)

44 mfcol parameter > par(mfcol = c(2,2)) > plot(shop$ads, shop$sales) > plot(shop$comp, shop$sales) > plot(shop$inv, shop$sales)

45 mfcol parameter > par(mfcol = c(2,2)) > plot(shop$ads, shop$sales) > plot(shop$comp, shop$sales) > plot(shop$inv, shop$sales) > plot(shop$size_dist, shop$sales) 2 rows 2 cols par(mfcol = c(2,2))

46 Reset the grid > par(mfrow = c(1,1)) > plot(shop$sales, shop$ads)

47 layout() > grid <- matrix(c(1, 1, 2, 3), nrow = 2, ncol = 2, byrow = TRUE) > grid [,1] [,2] [1,] 1 1 [2,] 2 3 > layout(grid) > plot(shop$ads, shop$sales) > plot(shop$comp, shop$sales) > plot(shop$inv, shop$sales)

48 Reset the grid > layout(1) > par(mfcol = c(1,1))

49 Reset all parameters > old_par <- par() > par(col = "red") > plot(shop$ads, shop$sales)

50 Reset all parameters > old_par <- par() > par(col = "red") > plot(shop$ads, shop$sales) > par(old_par) > plot(shop$ads, shop$sales)

51 Stack graphical elements > plot(shop$ads, shop$sales, pch = 16, col = 2, xlab = "advertisement", ylab = "net sales") > lm_sales <- lm(shop$sales ~ shop$ads)

52 Stack graphical elements > plot(shop$ads, shop$sales, pch = 16, col = 2, xlab = "advertisement", ylab = "net sales") > lm_sales <- lm(shop$sales ~ shop$ads) > abline(coef(lm_sales), lwd = 2)

53 Stack graphical elements > plot(shop$ads, shop$sales, pch = 16, col = 2, xlab = "advertisement", ylab = "net sales") > lm_sales <- lm(shop$sales ~ shop$ads) > abline(coef(lm_sales), lwd = 2) > lines(shop$ads, shop$sales) points() lines() segments() text()

54 Stack graphical elements > ranks <- order(shop$ads) > plot(shop$ads, shop$sales, pch = 16, col = 2, xlab = "advertisement", ylab = "net sales")

55 Stack graphical elements > ranks <- order(shop$ads) > plot(shop$ads, shop$sales, pch = 16, col = 2, xlab = "advertisement", ylab = "net sales") > abline(coef(lm_sales), lwd = 2)

56 Stack graphical elements > ranks <- order(shop$ads) > plot(shop$ads, shop$sales, pch = 16, col = 2, xlab = "advertisement", ylab = "net sales") > abline(coef(lm_sales), lwd = 2) > lines(shop$ads[ranks], shop$sales[ranks])

57 INTRODUCTION TO R Let s practice!

Graphics - Part III: Basic Graphics Continued

Graphics - Part III: Basic Graphics Continued Graphics - Part III: Basic Graphics Continued Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin Highway MPG 20 25 30 35 40 45 50 y^i e i = y i y^i 2000 2500 3000 3500 4000 Car Weight Copyright

More information

Data Visualization. Andrew Jaffe Instructor

Data Visualization. Andrew Jaffe Instructor Module 9 Data Visualization Andrew Jaffe Instructor Basic Plots We covered some basic plots previously, but we are going to expand the ability to customize these basic graphics first. 2/45 Read in Data

More information

AA BB CC DD EE. Introduction to Graphics in R

AA BB CC DD EE. Introduction to Graphics in R Introduction to Graphics in R Cori Mar 7/10/18 ### Reading in the data dat

More information

data visualization Show the Data Snow Month skimming deep waters

data visualization Show the Data Snow Month skimming deep waters data visualization skimming deep waters Show the Data Snow 2 4 6 8 12 Minimize Distraction Minimize Distraction Snow 2 4 6 8 12 2 4 6 8 12 Make Big Data Coherent Reveal Several Levels of Detail 1974 1975

More information

Statistical Programming with R

Statistical 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 information

Using Built-in Plotting Functions

Using Built-in Plotting Functions Workshop: Graphics in R Katherine Thompson (katherine.thompson@uky.edu Department of Statistics, University of Kentucky September 15, 2016 Using Built-in Plotting Functions ## Plotting One Quantitative

More information

R Workshop Module 3: Plotting Data Katherine Thompson Department of Statistics, University of Kentucky

R Workshop Module 3: Plotting Data Katherine Thompson Department of Statistics, University of Kentucky R Workshop Module 3: Plotting Data Katherine Thompson (katherine.thompson@uky.edu Department of Statistics, University of Kentucky October 15, 2013 Reading in Data Start by reading the dataset practicedata.txt

More information

An Introduction to R Graphics

An 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 information

Advanced Graphics with R

Advanced Graphics with R Advanced Graphics with R Paul Murrell Universitat de Barcelona April 30 2009 Session overview: (i) Introduction Graphic formats: Overview and creating graphics in R Graphical parameters in R: par() Selected

More information

IST 3108 Data Analysis and Graphics Using R Week 9

IST 3108 Data Analysis and Graphics Using R Week 9 IST 3108 Data Analysis and Graphics Using R Week 9 Engin YILDIZTEPE, Ph.D 2017-Spring Introduction to Graphics >y plot (y) In R, pictures are presented in the active graphical device or window.

More information

Introduction to R for Epidemiologists

Introduction to R for Epidemiologists Introduction to R for Epidemiologists Jenna Krall, PhD Thursday, January 29, 2015 Final project Epidemiological analysis of real data Must include: Summary statistics T-tests or chi-squared tests Regression

More information

Continuous-time stochastic simulation of epidemics in R

Continuous-time stochastic simulation of epidemics in R Continuous-time stochastic simulation of epidemics in R Ben Bolker May 16, 2005 1 Introduction/basic code Using the Gillespie algorithm, which assumes that all the possible events that can occur (death

More information

Module 10. Data Visualization. Andrew Jaffe Instructor

Module 10. Data Visualization. Andrew Jaffe Instructor Module 10 Data Visualization Andrew Jaffe Instructor Basic Plots We covered some basic plots on Wednesday, but we are going to expand the ability to customize these basic graphics first. 2/37 But first...

More information

Types of Plotting Functions. Managing graphics devices. Further High-level Plotting Functions. The plot() Function

Types 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 information

Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington

Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington Class Outline - The R Environment and Graphics Engine - Basic Graphs

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

Exploratory Data Analysis - Part 2 September 8, 2005

Exploratory Data Analysis - Part 2 September 8, 2005 Exploratory Data Analysis - Part 2 September 8, 2005 Exploratory Data Analysis - Part 2 p. 1/20 Trellis Plots Trellis plots (S-Plus) and Lattice plots in R also create layouts for multiple plots. A trellis

More information

DSCI 325: Handout 18 Introduction to Graphics in R

DSCI 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 information

Plotting Complex Figures Using R. Simon Andrews v

Plotting Complex Figures Using R. Simon Andrews v Plotting Complex Figures Using R Simon Andrews simon.andrews@babraham.ac.uk v2017-11 The R Painters Model Plot area Base plot Overlays Core Graph Types Local options to change a specific plot Global options

More information

Statistical Programming Camp: An Introduction to R

Statistical Programming Camp: An Introduction to R Statistical Programming Camp: An Introduction to R Handout 3: Data Manipulation and Summarizing Univariate Data Fox Chapters 1-3, 7-8 In this handout, we cover the following new materials: ˆ Using logical

More information

Graphics in R STAT 133. Gaston Sanchez. Department of Statistics, UC Berkeley

Graphics in R STAT 133. Gaston Sanchez. Department of Statistics, UC Berkeley Graphics in R STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 Base Graphics 2 Graphics in R Traditional

More information

The Basics of Plotting in R

The Basics of Plotting in R The Basics of Plotting in R R has a built-in Datasets Package: iris mtcars precip faithful state.x77 USArrests presidents ToothGrowth USJudgeRatings You can call built-in functions like hist() or plot()

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

Basic Statistical Graphics in R. Stem and leaf plots 100,100,100,99,98,97,96,94,94,87,83,82,77,75,75,73,71,66,63,55,55,55,51,19

Basic Statistical Graphics in R. Stem and leaf plots 100,100,100,99,98,97,96,94,94,87,83,82,77,75,75,73,71,66,63,55,55,55,51,19 Basic Statistical Graphics in R. Stem and leaf plots Example. Create a vector of data titled exam containing the following scores: 100,100,100,99,98,97,96,94,94,87,83,82,77,75,75,73,71,66,63,55,55,55,51,19

More information

CIND123 Module 6.2 Screen Capture

CIND123 Module 6.2 Screen Capture CIND123 Module 6.2 Screen Capture Hello, everyone. In this segment, we will discuss the basic plottings in R. Mainly; we will see line charts, bar charts, histograms, pie charts, and dot charts. Here is

More information

Recap From Last Time: Today s Learning Goals. Today s Learning Goals BIMM 143. Data visualization with R. Lecture 5. Barry Grant

Recap From Last Time: Today s Learning Goals. Today s Learning Goals BIMM 143. Data visualization with R. Lecture 5. Barry Grant BIMM 143 Data visualization with R Lecture 5 Barry Grant http://thegrantlab.org/bimm143 Recap From Last Time: What is R and why should we use it? Familiarity with R s basic syntax. Familiarity with major

More information

limma: A brief introduction to R

limma: 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 information

Chapter 2: Descriptive Statistics: Tabular and Graphical Methods

Chapter 2: Descriptive Statistics: Tabular and Graphical Methods Chapter 2: Descriptive Statistics: Tabular and Graphical Methods Example 1 C2_1

More information

Statistics 251: Statistical Methods

Statistics 251: Statistical Methods Statistics 251: Statistical Methods Summaries and Graphs in R Module R1 2018 file:///u:/documents/classes/lectures/251301/renae/markdown/master%20versions/summary_graphs.html#1 1/14 Summary Statistics

More information

Package beanplot. R topics documented: February 19, Type Package

Package beanplot. R topics documented: February 19, Type Package Type Package Package beanplot February 19, 2015 Title Visualization via Beanplots (like Boxplot/Stripchart/Violin Plot) Version 1.2 Date 2014-09-15 Author Peter Kampstra Maintainer Peter Kampstra

More information

Introduction to R: Day 2 September 20, 2017

Introduction to R: Day 2 September 20, 2017 Introduction to R: Day 2 September 20, 2017 Outline RStudio projects Base R graphics plotting one or two continuous variables customizable elements of plots saving plots to a file Create a new project

More information

Practical 2: Plotting

Practical 2: Plotting Practical 2: Plotting Complete this sheet as you work through it. If you run into problems, then ask for help - don t skip sections! Open Rstudio and store any files you download or create in a directory

More information

Package simed. November 27, 2017

Package simed. November 27, 2017 Version 1.0.3 Title Simulation Education Author Barry Lawson, Larry Leemis Package simed November 27, 2017 Maintainer Barry Lawson Imports graphics, grdevices, methods, stats, utils

More information

BIMM-143: INTRODUCTION TO BIOINFORMATICS (Lecture 5)

BIMM-143: INTRODUCTION TO BIOINFORMATICS (Lecture 5) BIMM-143: INTRODUCTION TO BIOINFORMATICS (Lecture 5) Data exploration and visualization in R https://bioboot.github.io/bimm143_w18/lectures/#5 Dr. Barry Grant Overview: One of the biggest attractions to

More information

Exploratory Projection Pursuit

Exploratory Projection Pursuit Exploratory Projection Pursuit (Jerome Friedman, PROJECTION PURSUIT METHODS FOR DATA ANALYSIS, June. 1980, SLAC PUB-2768) Read in required files drive - D: code.dir - paste(drive, DATA/Data Mining R-Code,

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

Statistical Software Camp: Introduction to R

Statistical 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 information

Practice for Learning R and Learning Latex

Practice for Learning R and Learning Latex Practice for Learning R and Learning Latex Jennifer Pan August, 2011 Latex Environments A) Try to create the following equations: 1. 5+6 α = β2 2. P r( 1.96 Z 1.96) = 0.95 ( ) ( ) sy 1 r 2 3. ˆβx = r xy

More information

Mixed models in R using the lme4 package Part 2: Lattice graphics

Mixed models in R using the lme4 package Part 2: Lattice graphics Mixed models in R using the lme4 package Part 2: Lattice graphics Douglas Bates University of Wisconsin - Madison and R Development Core Team University of Lausanne July 1,

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

R Graphics. SCS Short Course March 14, 2008

R Graphics. SCS Short Course March 14, 2008 R Graphics SCS Short Course March 14, 2008 Archeology Archeological expedition Basic graphics easy and flexible Lattice (trellis) graphics powerful but less flexible Rgl nice 3d but challenging Tons of

More information

Configuring Figure Regions with prepplot Ulrike Grömping 03 April 2018

Configuring Figure Regions with prepplot Ulrike Grömping 03 April 2018 Configuring Figure Regions with prepplot Ulrike Grömping 3 April 218 Contents 1 Purpose and concept of package prepplot 1 2 Overview of possibilities 2 2.1 Scope.................................................

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

The first one will centre the data and ensure unit variance (i.e. sphere the data):

The first one will centre the data and ensure unit variance (i.e. sphere the data): SECTION 5 Exploratory Projection Pursuit We are now going to look at an exploratory tool called projection pursuit (Jerome Friedman, PROJECTION PURSUIT METHODS FOR DATA ANALYSIS, June. 1980, SLAC PUB-2768)

More information

The following presentation is based on the ggplot2 tutotial written by Prof. Jennifer Bryan.

The following presentation is based on the ggplot2 tutotial written by Prof. Jennifer Bryan. Graphics Agenda Grammer of Graphics Using ggplot2 The following presentation is based on the ggplot2 tutotial written by Prof. Jennifer Bryan. ggplot2 (wiki) ggplot2 is a data visualization package Created

More information

R Workshop 1: Introduction to R

R Workshop 1: Introduction to R R Workshop 1: Introduction to R Gavin Simpson Environmental Change Research Centre, Department of Geography UCL April 30, 2013 Gavin Simpson (ECRC, UCL) Introduction to R April 30, 2013 1 / 43 Outline

More information

Importing and visualizing data in R. Day 3

Importing and visualizing data in R. Day 3 Importing and visualizing data in R Day 3 R data.frames Like pandas in python, R uses data frame (data.frame) object to support tabular data. These provide: Data input Row- and column-wise manipulation

More information

R version ( ) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN

R version ( ) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN Math 3070 1. Treibergs County Data: Histograms with variable Class Widths. Name: Example June 1, 2011 Data File Used in this Analysis: # Math 3070-1 County populations Treibergs # # Source: C Goodall,

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)

> 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 information

Az R adatelemzési nyelv

Az R adatelemzési nyelv Az R adatelemzési nyelv alapjai II. Egészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu Functions Functions Functions do things with data Input : function arguments (0,1,2, ) Output

More information

Shrinkage of logarithmic fold changes

Shrinkage of logarithmic fold changes Shrinkage of logarithmic fold changes Michael Love August 9, 2014 1 Comparing the posterior distribution for two genes First, we run a DE analysis on the Bottomly et al. dataset, once with shrunken LFCs

More information

Statistics Lecture 6. Looking at data one variable

Statistics Lecture 6. Looking at data one variable Statistics 111 - Lecture 6 Looking at data one variable Chapter 1.1 Moore, McCabe and Craig Probability vs. Statistics Probability 1. We know the distribution of the random variable (Normal, Binomial)

More information

Package EnQuireR. R topics documented: February 19, Type Package Title A package dedicated to questionnaires Version 0.

Package EnQuireR. R topics documented: February 19, Type Package Title A package dedicated to questionnaires Version 0. Type Package Title A package dedicated to questionnaires Version 0.10 Date 2009-06-10 Package EnQuireR February 19, 2015 Author Fournier Gwenaelle, Cadoret Marine, Fournier Olivier, Le Poder Francois,

More information

R Bootcamp Part I (B)

R Bootcamp Part I (B) R Bootcamp Part I (B) An R Script is available to make it easy for you to copy/paste all the tutorial commands into RStudio: http://statistics.uchicago.edu/~collins/rbootcamp/rbootcamp1b_rcode.r Preliminaries:

More information

Spring 2017 CS130 - Intro to R 1 R VISUALIZING DATA. Spring 2017 CS130 - Intro to R 2

Spring 2017 CS130 - Intro to R 1 R VISUALIZING DATA. Spring 2017 CS130 - Intro to R 2 Spring 2017 CS130 - Intro to R 1 R VISUALIZING DATA Spring 2017 Spring 2017 CS130 - Intro to R 2 Goals for this lecture: Review constructing Data Frame, Categorizing variables Construct basic graph, learn

More information

03 - Intro to graphics (with ggplot2)

03 - Intro to graphics (with ggplot2) 3 - Intro to graphics (with ggplot2) ST 597 Spring 217 University of Alabama 3-dataviz.pdf Contents 1 Intro to R Graphics 2 1.1 Graphics Packages................................ 2 1.2 Base Graphics...................................

More information

Outline. Part 2: Lattice graphics. The formula/data method of specifying graphics. Exploring and presenting data. Presenting data.

Outline. Part 2: Lattice graphics. The formula/data method of specifying graphics. Exploring and presenting data. Presenting data. Outline Part 2: Lattice graphics ouglas ates University of Wisconsin - Madison and R evelopment ore Team Sept 08, 2010 Presenting data Scatter plots Histograms and density plots

More information

Rstudio GGPLOT2. Preparations. The first plot: Hello world! W2018 RENR690 Zihaohan Sang

Rstudio GGPLOT2. Preparations. The first plot: Hello world! W2018 RENR690 Zihaohan Sang Rstudio GGPLOT2 Preparations There are several different systems for creating data visualizations in R. We will introduce ggplot2, which is based on Leland Wilkinson s Grammar of Graphics. The learning

More information

R Graphics. Paul Murrell. The University of Auckland. R Graphics p.1/47

R Graphics. Paul Murrell. The University of Auckland. R Graphics p.1/47 R Graphics p.1/47 R Graphics Paul Murrell paul@stat.auckland.ac.nz The University of Auckland R Graphics p.2/47 Overview Standard (base) R graphics grid graphics Graphics Regions and Coordinate Systems

More information

ddhazard Diagnostics Benjamin Christoffersen

ddhazard Diagnostics Benjamin Christoffersen ddhazard Diagnostics Benjamin Christoffersen 2017-11-25 Introduction This vignette will show examples of how the residuals and hatvalues functions can be used for an object returned by ddhazard. See vignette("ddhazard",

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

Package sciplot. February 15, 2013

Package sciplot. February 15, 2013 Package sciplot February 15, 2013 Version 1.1-0 Title Scientific Graphing Functions for Factorial Designs Author Manuel Morales , with code developed by the R Development Core Team

More information

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff Package munfold February 8, 2016 Type Package Title Metric Unfolding Version 0.3.5 Date 2016-02-08 Author Martin Elff Maintainer Martin Elff Description Multidimensional unfolding using

More information

Dr. Junchao Xia Center of Biophysics and Computational Biology. Fall /6/ /13

Dr. Junchao Xia Center of Biophysics and Computational Biology. Fall /6/ /13 BIO5312 Biostatistics R Session 02: Graph Plots in R Dr. Junchao Xia Center of Biophysics and Computational Biology Fall 2016 9/6/2016 1 /13 Graphic Methods Graphic methods of displaying data give a quick

More information

Canadian Bioinforma,cs Workshops.

Canadian 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 information

Package desplot. R topics documented: April 3, 2018

Package desplot. R topics documented: April 3, 2018 Package desplot April 3, 2018 Title Plotting Field Plans for Agricultural Experiments Version 1.4 Date 2018-04-02 Type Package Description A function for plotting maps of agricultural field experiments

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

Graph tool instructions and R code

Graph tool instructions and R code Graph tool instructions and R code 1) Prepare data: tab-delimited format Data need to be inputted in a tab-delimited format. This can be easily achieved by preparing the data in a spread sheet program

More information

Module 6: Advanced Plotting in R

Module 6: Advanced Plotting in R Module 6: Advanced Plotting in R The purpose of this handout is to teach you the basic elements of making advanced graphics in R. You do not need to have completed Modules 1-4 in order for this Module

More information

Introduction Basics Simple Statistics Graphics. Using R for Data Analysis and Graphics. 4. Graphics

Introduction Basics Simple Statistics Graphics. Using R for Data Analysis and Graphics. 4. Graphics Using R for Data Analysis and Graphics 4. Graphics Overview 4.1 Overview Several R graphics functions have been presented so far: > plot(d.sport[,"kugel"], d.sport[,"speer"], + xlab="ball push", ylab="javelin",

More information

Plotting: An Iterative Process

Plotting: An Iterative Process Plotting: An Iterative Process Plotting is an iterative process. First we find a way to represent the data that focusses on the important aspects of the data. What is considered an important aspect may

More information

Package MmgraphR. R topics documented: September 14, Type Package

Package MmgraphR. R topics documented: September 14, Type Package Type Package Package MmgraphR September 14, 2018 Title Graphing for Markov, Hidden Markov, and Mixture Transition Distribution Models Version 0.3-1 Date 2018-08-23 Maintainer Pauline Adamopoulou

More information

Package arphit. March 28, 2019

Package arphit. March 28, 2019 Type Package Title RBA-style R Plots Version 0.3.1 Author Angus Moore Package arphit March 28, 2019 Maintainer Angus Moore Easily create RBA-style graphs

More information

Week 4. Big Data Analytics - data.frame manipulation with dplyr

Week 4. Big Data Analytics - data.frame manipulation with dplyr Week 4. Big Data Analytics - data.frame manipulation with dplyr Hyeonsu B. Kang hyk149@eng.ucsd.edu April 2016 1 Dplyr In the last lecture we have seen how to index an individual cell in a data frame,

More information

Stat 849: Plotting responses and covariates

Stat 849: Plotting responses and covariates Stat 849: Plotting responses and covariates Douglas Bates Department of Statistics University of Wisconsin, Madison 2010-09-03 Outline R Graphics Systems Brain weight Cathedrals Longshoots Domedata Summary

More information

Data Mining The first one will centre the data and ensure unit variance (i.e. sphere the data)..

Data Mining The first one will centre the data and ensure unit variance (i.e. sphere the data).. Data Mining 2017 180 SECTION 5 B-PP Exploratory Projection Pursuit We are now going to look at an exploratory tool called projection pursuit (Jerome Friedman, PROJECTION PURSUIT METHODS FOR DATA ANALYSIS,

More information

Stat 849: Plotting responses and covariates

Stat 849: Plotting responses and covariates Stat 849: Plotting responses and covariates Douglas Bates 10-09-03 Outline Contents 1 R Graphics Systems Graphics systems in R ˆ R provides three dierent high-level graphics systems base graphics The system

More information

jackstraw: Statistical Inference using Latent Variables

jackstraw: Statistical Inference using Latent Variables jackstraw: Statistical Inference using Latent Variables Neo Christopher Chung August 7, 2018 1 Introduction This is a vignette for the jackstraw package, which performs association tests between variables

More information

Package JBTools. R topics documented: June 2, 2015

Package JBTools. R topics documented: June 2, 2015 Package JBTools June 2, 2015 Title Misc Small Tools and Helper Functions for Other Code of J. Buttlar Version 0.7.2.9 Date 2015-05-20 Author Maintainer Collection of several

More information

Package basictrendline

Package basictrendline Version 2.0.3 Date 2018-07-26 Package basictrendline July 26, 2018 Title Add Trendline and Confidence Interval of Basic Regression Models to Plot Maintainer Weiping Mei Plot, draw

More information

Basics of Plotting Data

Basics of Plotting Data Basics of Plotting Data Luke Chang Last Revised July 16, 2010 One of the strengths of R over other statistical analysis packages is its ability to easily render high quality graphs. R uses vector based

More information

Thomas Vincent Head of Data Science, Getty Images

Thomas Vincent Head of Data Science, Getty Images VISUALIZING TIME SERIES DATA IN PYTHON Clean your time series data Thomas Vincent Head of Data Science, Getty Images The CO2 level time series A snippet of the weekly measurements of CO2 levels 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

Package splicegear. R topics documented: December 4, Title splicegear Version Author Laurent Gautier

Package splicegear. R topics documented: December 4, Title splicegear Version Author Laurent Gautier Title splicegear Version 1.51.0 Author Laurent Gautier Package splicegear December 4, 2017 A set of tools to work with alternative splicing Maintainer Laurent Gautier

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

Install RStudio from - use the standard installation.

Install RStudio from   - use the standard installation. Session 1: Reading in Data Before you begin: Install RStudio from http://www.rstudio.com/ide/download/ - use the standard installation. Go to the course website; http://faculty.washington.edu/kenrice/rintro/

More information

Package waterfall. R topics documented: February 15, Type Package. Version Date Title Waterfall Charts in R

Package waterfall. R topics documented: February 15, Type Package. Version Date Title Waterfall Charts in R Package waterfall February 15, 2013 Type Package Version 0.9.9.20121030 Date 2012-10-30 Title Waterfall Charts in R Author James P. Howard, II Maintainer James P. Howard, II

More information

An Introduction to R 2.2 Statistical graphics

An Introduction to R 2.2 Statistical graphics An Introduction to R 2.2 Statistical graphics Dan Navarro (daniel.navarro@adelaide.edu.au) School of Psychology, University of Adelaide ua.edu.au/ccs/people/dan DSTO R Workshop, 29-Apr-2015 Scatter plots

More information

Package visualizationtools

Package visualizationtools Package visualizationtools April 12, 2011 Type Package Title Package contains a few functions to visualize statistical circumstances. Version 0.2 Date 2011-04-06 Author Thomas Roth Etienne Stockhausen

More information

Contents. Introduction 2

Contents. Introduction 2 R code for The human immune system is robustly maintained in multiple stable equilibriums shaped by age and cohabitation Vasiliki Lagou, on behalf of co-authors 18 September 2015 Contents Introduction

More information

The LDheatmap Package

The LDheatmap Package The LDheatmap Package May 6, 2006 Title Graphical display of pairwise linkage disequilibria between SNPs Version 0.2-1 Author Ji-Hyung Shin , Sigal Blay , Nicholas Lewin-Koh

More information

The sspline Package. October 11, 2007

The sspline Package. October 11, 2007 The sspline Package October 11, 2007 Version 0.1-5 Date 2007/10/10 Title Smoothing Splines on the Sphere Author Xianhong Xie Maintainer Xianhong Xie Depends R (>=

More information

Package Mondrian. R topics documented: March 4, Type Package

Package Mondrian. R topics documented: March 4, Type Package Type Package Package Mondrian March 4, 2016 Title A Simple Graphical Representation of the Relative Occurrence and Co-Occurrence of Events The unique function of this package allows representing in a single

More information

Package gains. September 12, 2017

Package gains. September 12, 2017 Package gains September 12, 2017 Version 1.2 Date 2017-09-08 Title Lift (Gains) Tables and Charts Author Craig A. Rolling Maintainer Craig A. Rolling Depends

More information

Package mau. January 17, 2018

Package mau. January 17, 2018 Type Package Version 0.1.2 Package mau January 17, 2018 Title Decision Models with Multi Attribute Utility Theory Encoding UTF-8 Date 2018-01-17 Provides functions for the creation, evaluation and test

More information

Package nonmem2r. April 5, 2018

Package nonmem2r. April 5, 2018 Type Package Package nonmem2r April 5, 2018 Title Loading NONMEM Output Files and Simulate with Parameter Uncertainty Version 0.1.9 Author Magnus Astrand Maintainer Magnus Astrand

More information

Package sspline. R topics documented: February 20, 2015

Package sspline. R topics documented: February 20, 2015 Package sspline February 20, 2015 Version 0.1-6 Date 2013-11-04 Title Smoothing Splines on the Sphere Author Xianhong Xie Maintainer Xianhong Xie Depends R

More information

Learning R Series Session 5: Oracle R Enterprise 1.3 Integrating R Results and Images with OBIEE Dashboards Mark Hornick Oracle Advanced Analytics

Learning R Series Session 5: Oracle R Enterprise 1.3 Integrating R Results and Images with OBIEE Dashboards Mark Hornick Oracle Advanced Analytics Learning R Series Session 5: Oracle R Enterprise 1.3 Integrating R Results and Images with OBIEE Dashboards Mark Hornick Oracle Advanced Analytics Learning R Series 2012 Session Title

More information

MCMC for Bayesian Inference Metropolis: Solutions

MCMC for Bayesian Inference Metropolis: Solutions MCMC for Bayesian Inference Metropolis: Solutions Below are the solutions to these exercises on MCMC for Bayesian Inference Metropolis: Exercises. #### Run the folowing lines before doing the exercises:

More information

Combo Charts. Chapter 145. Introduction. Data Structure. Procedure Options

Combo Charts. Chapter 145. Introduction. Data Structure. Procedure Options Chapter 145 Introduction When analyzing data, you often need to study the characteristics of a single group of numbers, observations, or measurements. You might want to know the center and the spread about

More information