eda-R[1]

# eda-R[1] - R Help Exploratory Data Analysis Fall 2003 This...

This preview shows pages 1–3. Sign up to view the full content.

R Help Exploratory Data Analysis Fall 2003 This document describes how to use a number of R commands for plotting one variable and for calcu- lating one variable summary statistics. Speciﬁcally, it describes how to use R to create dotplots , histograms , stemplots , and boxplots , and to compute the mean , median , ﬁve-number summary , standard deviation , and variance of a variable. Let’s begin with the same glucose data set from last time. > 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) Dotplots. R does not have a built-in dotplot function. I have written a function in R code that works. The code is on the R Help Web page. Save this ﬁle to your computer and put it in your working directory. You can source this code using the File menu, selecting Source R code. .. , and following the directions. Alternatively, if the ﬁle dotplot.R is in your working directory this command will source the code and then create the dotplot. > source("dotplot.R") > dotplot(glucose) 70 80 90 100 110 120 130 ●● ● ●●●● ●● ●● Histograms. The hist function produces histograms. > hist(glucose) Bret Larget September 15, 2003

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Exploratory Data Analysis Fall 2003 Histogram of glucose glucose Frequency 70 80 90 100 110 120 130 140 0 4 8 12 By default, there were seven classes, each of width ten, ranging from 70 to 140. If we wanted to specify a diFerent number of classes, say 14, we could have typed this. > hist(glucose, breaks = 14) Histogram of glucose glucose 70 80 90 100 110 120 130 2 6 the bars red (color 2), we could have done this. > hist(glucose, breaks = seq(60, 140, by = 8), col = 2) Bret Larget September 15, 2003
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 09/15/2011 for the course MATH 324 taught by Professor Staff during the Spring '08 term at S.F. State.

### Page1 / 8

eda-R[1] - R Help Exploratory Data Analysis Fall 2003 This...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online