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

Size: px
Start display at page:

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

Transcription

1 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 - Modifying Basic Graphs - More Advanced Graphics - Other Resources This class is an introduction to creating graphics in R. R has a very powerful graphics engine, but this class only covers the more basic high-level traditional graphics. Even using just the high-level function calls can produce some very useful and interesting graphs. Some knowledge of R is expected. The R Environment and Graphics Engine - Traditional Graphics vs. Grid Graphics - High-level and low-level functions The R graphics engine is very powerful. Here are some examples of what can be done. The following plots were created only using traditional graphics. > demo(graphics) Some more complex and interesting graphics created using R: We won t be learning how to create the more exciting graphs in this class, but even just the traditional graphics allow you to do a lot. Basic Graphs > library(datasets) > mtcars >?mtcars Scatterplot A graph of Miles Per Gallon as a function of Weight of car > plot(mpg ~ wt, data = mtcars) Line Graph > uspop > class(uspop) A timeseries is a special type of object that will plot as a line > plot (uspop) 1

2 For a simple vector of (time-)ordered data, plot defaults to points. > plot(as.vector(uspop)) > plot(as.vector(uspop), type="l") > plot(as.vector(uspop), type="o") Histogram A graph of frequency of number of carburetors > hist (mtcars$carb) Boxplot The distribution of gross horsepower of the cars > boxplot(mtcars$hp) A more interesting comparison of boxplots: >?chickwts > chickwts > boxplot(chickwts$weight ~ chickwts$feed) Bar Chart There are six types of feed in the chickwts dataset. How many chickens are in each category? > chickwts$feed > table(chickwts$feed) A barplot of how many chickens are in each feed category: > barplot(table(chickwts$feed)) Pie Chart A pie chart showing how many chickens in each category: > pie(table(chickwts$feed)) Modifying Basic Graphs Now we know how to create the most common types of graphs. How can we modify them to look better and convey more information? Additional Functions After the graph is created by the function call, you can add to it with other functions. Some common ones are points(), lines(), text(), and legend(). These must be called after a plot function has been already called. These are considered "low-level" functions, but are still part of the traditional graphics. There might come a time when you have two sets of data and wish to see them plotted on top of each other. This is an artificial example, but shows how to do it: > plot(mtcars$mpg[1:20] ~ mtcars$wt[1:20]) > points(mtcars$mpg[21:32] ~ mtcars$mpg[21:32]) 2

3 > text(5, 30, "n=32") More likely you will create a scatterplot and then want to show the fitted regression line. abline() is a very useful function that will overlay the fitted equation. > plot(mtcars$mpg ~ mtcars$wt) > abline(lm(mtcars$mpg ~ mtcars$wt)) Changing Graph Parameters The basic graph functions we covered have many of the same modifiable parameters. They can be found in the help page for the function. Some more common things we may want to change: Adding a Main Title to the graph and labeling X and Y axes: main, xlab, ylab Car Weight", xlab="car Weight (lb/1000)", ylab="miles Per Gallon") Changing the Range on the X and Y Axes: xlim, ylim It doesn't make sense on this plot, but we might want to change the range on the x and y axis from the defaults. ylab="miles Per Gallon", xlim=c(0,10), ylim=c(0,40)) Changing the Color of Plotting Symbols: col ylab="miles Per Gallon", col="blue") There are many colors available to use. The easiest is to use them by name. To see colors with names: > colors() You can also use RGB and hexadecimal to create the exact color you want. (Don't worry if you don't know what this means.) Changing Plotting Symbols: pch Perhaps we want the plotting symbols to be triangles instead of open circles: ylab="miles Per Gallon", col="blue", pch=24) The most common plotting symbols are listed in points() >?points 3

4 Colors and symbols are a great way of conveying more information. Let's distinguish between cars that are automatic transmission and cars that are manual transmission. 0 = automatic and 1 = manual, so we'll make automatics blue and manuals red. ylab="miles Per Gallon", col=c("blue","red")[match(mtcars$am,c(0,1))]) Better yet, let's change the plotting symbol depending on how many cylinders it has. ylab="miles Per Gallon", col=c("blue","red")[match(mtcars$am, c(0,1))], pch=c(21, 24, 19)[match(mtcars$cyl, c(4, 6, 8))]) Now we need to label everything: > legend(3, 34, legend=c("automatic Transmission", "Manual Transmission"), fill=c("blue", "red")) > legend(4.25, 28, legend=c("4", "6", "8"), title="# Cylinders", pch=c(21, 24, 19)) Of course, you have to play around with the X and Y coordinates to get it to look right. But this plot shows how important and useful graphs are. A good graph can illustrate relationships between multiple variables very clearly and in a way that makes sense to people who don't understand statistics. Each type of graph has it's own parameters that you may wish to modify. Among the more common are: Histogram: Changing Break sizes: > hist (mtcars$qsec) > hist (mtcars$qsec, breaks=seq(from=12, to=24, by=0.5)) Boxplot: Multiple boxplots and changing widths to reflect sample size > boxplot(chickwts$weight ~ chickwts$feed) > table(chickwts$feed) > boxplot(chickwts$weight ~ chickwts$feed, width=table(chickwts$feed)) boxplot() has kindly put the multiple boxplots into alphabetical order for us, which is why we can use table(chickwts$feed) to get the vector of feed names. The number of chickens in each feed group is very similar, so it's hard to see the differences in widths of the boxplots. Let's cut off the last 10 rows of the dataset, leaving only 3 chickens in the casein category: > chickwts > boxplot(chickwts$weight[1:63] ~ chickwts$feed[1:63], width=table(chickwts$feed[1:63])) 4

5 The help pages for each function will help you change parameters to change the look of your graph. par() par() can be used to query or set graphical parameters. Many of the parameters you can set using par() can also be set using the high-level function call (e.g. specifying plotting symbols, colors, etc.). There are a couple things that are very useful to set in par(), though. >?par Putting several graphs in one window This can be very useful for comparing graphs. > par(mfrow=c(1,2)) > boxplot(chickwts$weight ~ chickwts$feed, width=table(chickwts$feed)) > boxplot(chickwts$weight[1:63] ~ chickwts$feed[1:63], width=table(chickwts$feed[1:63])) Changing Text Size (axis labels, axis ticks labels), Symbol size The help page for plot() shows that " " means we can give it parameters to pass to par(). The help page for par() tells us some of these parameters, such as cex, cex.axis, cex.lab, and cex.main, which change the sizes of the plotting symbols, the font size of the axis tick labels, the font size of the axis titles, and the font size of the main title, respectively. ylab="miles Per Gallon", cex.axis=0.75, cex.lab=1.5, cex.main=2, cex=4) Graphics Devices There are several graphics devices in R. I find the most useful one to be pdf(). This command starts the graphics device for creating pdf files. > pdf( file="c:\temp\rgraph.pdf", width=5, height=5) ylab="miles Per Gallon", col=c("blue","red")[match(mtcars$am, c(0,1))], pch=c(21, 24, 19)[match(mtcars$cyl, c(4, 6, 8))]) > legend(3, 34, legend=c("automatic Transmission", "Manual Transmission"), fill=c("blue", "red")) > legend(4.25, 28, legend=c("4", "6", "8"), title="# Cylinders", pch=c(21, 24, 19)) > dev.off() 5

6 Remember to type dev.off() at the end! This will close the pdf file properly. Other Resources Online CSSS Courses CSSS 508: Introduction to R CSSS 594: Visualizing Data For more advanced R graphics Murrell, Paul. (2005) R Graphics. Chapman & Hall/CRC Press. 6

R Visualizing Data. Fall Fall 2016 CS130 - Intro to R 1

R Visualizing Data. Fall Fall 2016 CS130 - Intro to R 1 R Visualizing Data Fall 2016 Fall 2016 CS130 - Intro to R 1 mtcars Data Frame R has a built-in data frame called mtcars Useful R functions length(object) # number of variables str(object) # structure of

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Intro to R for Epidemiologists

Intro to R for Epidemiologists Lab 9 (3/19/15) Intro to R for Epidemiologists Part 1. MPG vs. Weight in mtcars dataset The mtcars dataset in the datasets package contains fuel consumption and 10 aspects of automobile design and performance

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

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

A system for statistical analysis. Instructions for installing software. R, R-studio and the R-commander

A system for statistical analysis. Instructions for installing software. R, R-studio and the R-commander Instructions for installing software R, R-studio and the R-commander Graeme.Hutcheson@manchester.ac.uk Manchester Institute of Education, University of Manchester This course uses the following software...

More information

plot(seq(0,10,1), seq(0,10,1), main = "the Title", xlim=c(1,20), ylim=c(1,20), col="darkblue");

plot(seq(0,10,1), seq(0,10,1), main = the Title, xlim=c(1,20), ylim=c(1,20), col=darkblue); R for Biologists Day 3 Graphing and Making Maps with Your Data Graphing is a pretty convenient use for R, especially in Rstudio. plot() is the most generalized graphing function. If you give it all numeric

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

Graphics #1. R Graphics Fundamentals & Scatter Plots

Graphics #1. R Graphics Fundamentals & Scatter Plots Graphics #1. R Graphics Fundamentals & Scatter Plots In this lab, you will learn how to generate customized publication-quality graphs in R. Working with R graphics can be done as a stepwise process. Rather

More information

Fertilizer Dry Moist Wet Fertilizer Dry Moist Wet Control Control N N P P NP NP 9 8 7

Fertilizer Dry Moist Wet Fertilizer Dry Moist Wet Control Control N N P P NP NP 9 8 7 Part 6 Bar Plots & Dot Plots Bar and dot plots are used in two ways: (1) to display proportions of categories, and (2) to compare class means, i.e. experimental treatments or sampling sites. In either

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

Homework 1 Excel Basics

Homework 1 Excel Basics Homework 1 Excel Basics Excel is a software program that is used to organize information, perform calculations, and create visual displays of the information. When you start up Excel, you will see the

More information

MGMT 3125 Introduction to Data Visualization

MGMT 3125 Introduction to Data Visualization MGMT 3125 Introduction to Data Visualization John Sokol, MS Week 2 1/30/2019 Chapter 2: Choose an effective visual Agenda Chapter 2: Choose an effective visual Introduction to Tableau Week 2 action items

More information

Welcome to Workshop: Making Graphs

Welcome to Workshop: Making Graphs Welcome to Workshop: Making Graphs I. Please sign in on the sign in sheet (so I can send you slides & follow up for feedback). II. Download materials you ll need from my website (http://faculty.washington.edu/jhrl/teaching.html

More information

1 Introduction to Using Excel Spreadsheets

1 Introduction to Using Excel Spreadsheets Survey of Math: Excel Spreadsheet Guide (for Excel 2007) Page 1 of 6 1 Introduction to Using Excel Spreadsheets This section of the guide is based on the file (a faux grade sheet created for messing with)

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

Introduction to R Software

Introduction to R Software 1. Introduction R is a free software environment for statistical computing and graphics. It is almost perfectly compatible with S-plus. The only thing you need to do is download the software from the internet

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

INTRODUCTION TO R. Basic Graphics

INTRODUCTION TO R. Basic Graphics INTRODUCTION TO R Basic Graphics Graphics in R Create plots with code Replication and modification easy Reproducibility! graphics package ggplot2, ggvis, lattice graphics package Many functions plot()

More information

Stat 290: Lab 2. Introduction to R/S-Plus

Stat 290: Lab 2. Introduction to R/S-Plus Stat 290: Lab 2 Introduction to R/S-Plus Lab Objectives 1. To introduce basic R/S commands 2. Exploratory Data Tools Assignment Work through the example on your own and fill in numerical answers and graphs.

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

R Graph Essentials. Use R's powerful graphing capabilities to design and create professional-level graphics. David Alexander Lillis

R Graph Essentials. Use R's powerful graphing capabilities to design and create professional-level graphics. David Alexander Lillis R Graph Essentials Use R's powerful graphing capabilities to design and create professional-level graphics David Alexander Lillis BIRMINGHAM - MUMBAI R Graph Essentials Copyright 2014 Packt Publishing

More information

Installation and Introduction to Jupyter & RStudio

Installation and Introduction to Jupyter & RStudio Installation and Introduction to Jupyter & RStudio CSE 4/587 Data Intensive Computing Spring 2017 Prepared by Jacob Condello 1 Anaconda/Jupyter Installation 1.1 What is Anaconda? Anaconda is a freemium

More information

Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9

Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9 Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9 Contents 1 Introduction to Using Excel Spreadsheets 2 1.1 A Serious Note About Data Security.................................... 2 1.2

More information

Making plots in R [things I wish someone told me when I started grad school]

Making plots in R [things I wish someone told me when I started grad school] Making plots in R [things I wish someone told me when I started grad school] Kirk Lohmueller Department of Ecology and Evolutionary Biology UCLA September 22, 2017 In honor of Talk Like a Pirate Day...

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

Getting started with ggplot2

Getting started with ggplot2 Getting started with ggplot2 STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 ggplot2 2 Resources for

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

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

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

SHOW ME THE NUMBERS: DESIGNING YOUR OWN DATA VISUALIZATIONS PEPFAR Applied Learning Summit September 2017 A. Chafetz

SHOW ME THE NUMBERS: DESIGNING YOUR OWN DATA VISUALIZATIONS PEPFAR Applied Learning Summit September 2017 A. Chafetz SHOW ME THE NUMBERS: DESIGNING YOUR OWN DATA VISUALIZATIONS PEPFAR Applied Learning Summit September 2017 A. Chafetz Overview In order to prepare for the upcoming POART, you need to look into testing as

More information

Excel 2. Module 3 Advanced Charts

Excel 2. Module 3 Advanced Charts Excel 2 Module 3 Advanced Charts Revised 1/1/17 People s Resource Center Module Overview This module is part of the Excel 2 course which is for advancing your knowledge of Excel. During this lesson we

More information

LAB #1: DESCRIPTIVE STATISTICS WITH R

LAB #1: DESCRIPTIVE STATISTICS WITH R NAVAL POSTGRADUATE SCHOOL LAB #1: DESCRIPTIVE STATISTICS WITH R Statistics (OA3102) Lab #1: Descriptive Statistics with R Goal: Introduce students to various R commands for descriptive statistics. Lab

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

Math 121 Project 4: Graphs

Math 121 Project 4: Graphs Math 121 Project 4: Graphs Purpose: To review the types of graphs, and use MS Excel to create them from a dataset. Outline: You will be provided with several datasets and will use MS Excel to create graphs.

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

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

DATA VISUALIZATION WITH GGPLOT2. Grid Graphics

DATA VISUALIZATION WITH GGPLOT2. Grid Graphics DATA VISUALIZATION WITH GGPLOT2 Grid Graphics ggplot2 internals Explore grid graphics 35 30 Elements of ggplot2 plot 25 How do graphics work in R? 2 plotting systems mpg 20 15 base package grid graphics

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

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

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

Bar Charts and Frequency Distributions

Bar Charts and Frequency Distributions Bar Charts and Frequency Distributions Use to display the distribution of categorical (nominal or ordinal) variables. For the continuous (numeric) variables, see the page Histograms, Descriptive Stats

More information

Creating Graphs Using SAS ODS Graphics Designer

Creating Graphs Using SAS ODS Graphics Designer Creating Graphs Using SAS ODS Graphics Designer William Knabe Former Director of Statistical Applications, UI Information Technology Services SAS Summer Training Institute 2016 Slide 1 Overview. Evolution

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

Working with Charts Stratum.Viewer 6

Working with Charts Stratum.Viewer 6 Working with Charts Stratum.Viewer 6 Getting Started Tasks Additional Information Access to Charts Introduction to Charts Overview of Chart Types Quick Start - Adding a Chart to a View Create a Chart with

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

Tricking it Out: Tricks to personalize and customize your graphs.

Tricking it Out: Tricks to personalize and customize your graphs. Tricking it Out: Tricks to personalize and customize your graphs. Graphing templates may be used online without downloading them onto your own computer. However, if you would like to use the templates

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

Lab 3 - Part A. R Graphics Fundamentals & Scatter Plots

Lab 3 - Part A. R Graphics Fundamentals & Scatter Plots Lab 3 - Part A R Graphics Fundamentals & Scatter Plots In this lab, you will learn how to generate customized publication-quality graphs in R. Working with R graphics can be done as a stepwise process.

More information

Chapter 5 An Introduction to Basic Plotting Tools

Chapter 5 An Introduction to Basic Plotting Tools Chapter 5 An Introduction to Basic Plotting Tools We have demonstrated the use of R tools for importing data, manipulating data, extracting subsets of data, and making simple calculations, such as mean,

More information

Create a bar graph that displays the data from the frequency table in Example 1. See the examples on p Does our graph look different?

Create a bar graph that displays the data from the frequency table in Example 1. See the examples on p Does our graph look different? A frequency table is a table with two columns, one for the categories and another for the number of times each category occurs. See Example 1 on p. 247. Create a bar graph that displays the data from the

More information

Hacking FlowJo VX. 42 Time-Saving FlowJo Shortcuts To Help You Get Your Data Published No Matter What Flow Cytometer It Came From

Hacking FlowJo VX. 42 Time-Saving FlowJo Shortcuts To Help You Get Your Data Published No Matter What Flow Cytometer It Came From Hacking FlowJo VX 42 Time-Saving FlowJo Shortcuts To Help You Get Your Data Published No Matter What Flow Cytometer It Came From Contents 1. Change the default name of your files. 2. Edit your workspace

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

InfoMaster REPORT DESIGNER

InfoMaster REPORT DESIGNER InfoMaster REPORT DESIGNER TABLE OF CONTENTS About Customized Advanced Reports... 2 Pre-Defined Advanced Reports... 2 Create Custom Advanced Report... 4 Goal: Final Report... 4 Creating custom report:

More information

Package scatterd3. March 10, 2018

Package scatterd3. March 10, 2018 Type Package Title D3 JavaScript Scatterplot from R Version 0.8.2 Date 2018-03-09 Package scatterd3 March 10, 2018 Maintainer Julien Barnier Description Creates 'D3' 'JavaScript'

More information

Solution to Tumor growth in mice

Solution to Tumor growth in mice Solution to Tumor growth in mice Exercise 1 1. Import the data to R Data is in the file tumorvols.csv which can be read with the read.csv2 function. For a succesful import you need to tell R where exactly

More information

Project 11 Graphs (Using MS Excel Version )

Project 11 Graphs (Using MS Excel Version ) Project 11 Graphs (Using MS Excel Version 2007-10) Purpose: To review the types of graphs, and use MS Excel 2010 to create them from a dataset. Outline: You will be provided with several datasets and will

More information

How to create a theograph. A step-by-step guide

How to create a theograph. A step-by-step guide How to create a theograph A step-by-step guide Simple theograph Firstly, to create a theograph you need data covering multiple services and events with relevant dates. Once in Tableau we are going to create

More information

University of California, Los Angeles Department of Statistics

University of California, Los Angeles Department of Statistics University of California, Los Angeles Department of Statistics Statistics 13 Instructor: Nicolas Christou Data analysis with R - Some simple commands When you are in R, the command line begins with > To

More information

0 Graphical Analysis Use of Excel

0 Graphical Analysis Use of Excel Lab 0 Graphical Analysis Use of Excel What You Need To Know: This lab is to familiarize you with the graphing ability of excels. You will be plotting data set, curve fitting and using error bars on the

More information

Using Charts in a Presentation 6

Using Charts in a Presentation 6 Using Charts in a Presentation 6 LESSON SKILL MATRIX Skill Exam Objective Objective Number Building Charts Create a chart. Import a chart. Modifying the Chart Type and Data Change the Chart Type. 3.2.3

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

Assignment 6: Matlab Practice and Plots

Assignment 6: Matlab Practice and Plots CEE 3804: Computer Applications in Civil Engineering Spring 2012 Solution Set Problem 1 Assignment 6: Matlab Practice and Plots Instructor: Trani A civil engineer sends you a comma separated data file

More information

Scientific Python: matplotlib

Scientific Python: matplotlib Scientific Python: matplotlib 17 July 2014 Introduction and Aims This exercise introduces the matplotlib module of Python. Matplotlib is a versatile plotting library that can be used to produce both quick

More information

Visual Analytics. Visualizing multivariate data:

Visual Analytics. Visualizing multivariate data: Visual Analytics 1 Visualizing multivariate data: High density time-series plots Scatterplot matrices Parallel coordinate plots Temporal and spectral correlation plots Box plots Wavelets Radar and /or

More information

6 Using Technology Wisely

6 Using Technology Wisely 6 Using Technology Wisely Concepts: Advantages and Disadvantages of Graphing Calculators How Do Calculators Sketch Graphs? When Do Calculators Produce Incorrect Graphs? The Greatest Integer Function Graphing

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

EXCEL SKILLS. Selecting Cells: Step 1: Click and drag to select the cells you want.

EXCEL SKILLS. Selecting Cells: Step 1: Click and drag to select the cells you want. Selecting Cells: Step 1: Click and drag to select the cells you want. Naming Cells: Viewlet available Step 2: To select different cells that are not next to each other, hold down as you click and

More information

CREATING POWERFUL AND EFFECTIVE GRAPHICAL DISPLAYS: AN INTRODUCTION TO LATTICE GRAPHICS IN R

CREATING POWERFUL AND EFFECTIVE GRAPHICAL DISPLAYS: AN INTRODUCTION TO LATTICE GRAPHICS IN R APSA Short Course, SC 13 Chicago, Illinois August 29, 2007 Michigan State University CREATING POWERFUL AND EFFECTIVE GRAPHICAL DISPLAYS: AN INTRODUCTION TO LATTICE GRAPHICS IN R I. Some Basic R Concepts

More information

Intro To Excel Spreadsheet for use in Introductory Sciences

Intro To Excel Spreadsheet for use in Introductory Sciences INTRO TO EXCEL SPREADSHEET (World Population) Objectives: Become familiar with the Excel spreadsheet environment. (Parts 1-5) Learn to create and save a worksheet. (Part 1) Perform simple calculations,

More information

Introduction to Nesstar

Introduction to Nesstar Introduction to Nesstar Nesstar is a software system for online data analysis. It is available for use with many of the large UK surveys on the UK Data Service website. You will know whether you can use

More information

University of California, Los Angeles Department of Statistics

University of California, Los Angeles Department of Statistics University of California, Los Angeles Department of Statistics Statistics 12 Instructor: Nicolas Christou Data analysis with R - Some simple commands When you are in R, the command line begins with > To

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

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

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

> 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

Making Science Graphs and Interpreting Data

Making Science Graphs and Interpreting Data Making Science Graphs and Interpreting Data Eye Opener: 5 mins What do you see? What do you think? Look up terms you don t know What do Graphs Tell You? A graph is a way of expressing a relationship between

More information

Package qrfactor. February 20, 2015

Package qrfactor. February 20, 2015 Type Package Package qrfactor February 20, 2015 Title Simultaneous simulation of Q and R mode factor analyses with Spatial data Version 1.4 Date 2014-01-02 Author George Owusu Maintainer

More information

Submission Guideline Checklist

Submission Guideline Checklist Submission Guideline Checklist Please use this checklist as a guide to ensure that files are correctly prepared for submission. Please ensure that you have read the detailed Instructions for Authors before

More information

Getting Started with JMP at ISU

Getting Started with JMP at ISU Getting Started with JMP at ISU 1 Introduction JMP (pronounced like jump ) is the new campus-wide standard statistical package for introductory statistics courses at Iowa State University. JMP is produced

More information

A tutorial for the sendplot R package

A tutorial for the sendplot R package A tutorial for the sendplot R package Lori A. Shepherd, John A. Kirchgraber Jr., and Daniel P. Gaile January 8, 2010 Statistical Genetics and Genomics Research Group Department of Biostatistics, University

More information

#1#set Working directory #2# Download packages: source(" bioclite("affy") library (affy)

#1#set Working directory #2# Download packages: source(  bioclite(affy) library (affy) #1#set Working directory #2# Download packages: source("http://bioconductor.org/bioclite.r") bioclite("affy") library (affy) #3# Read the CEL files: Med

More information