University of Minnesota, Twin Cities School of Statistics Stat 3011 Rweb Textbook (Wild and Seber)
unemploy, those for which the variable group
has the value "eec". This is documented on the R on-line
help for
square brackets and
relational operators. To see that these are indeed the data you are
to plot, look at the data file
unemploy.txt.
scale=3 to the stem
function is necessary so that R will draw the same stem-and-leaf plot
as in the textbook.
This is documented on the R on-line
help for
stem.
There is no way to tell exactly what any particular value of the
scale argument does. You just have to experiment until
you get a plot that you like.
length, those for which the variable gender
has the value "female". This is just like the
dot plot example.
To see that these are indeed the data you are
to plot, look at the data file
coyote.txt.
right=FALSE to the hist
function is necessary so that R will draw the same histogram
as in the textbook.
This is documented on the R on-line
help for
hist.
There is no reason to prefer the histogram you get with right=TRUE
over the default behavior right=FALSE. Thus there is no reason
to use this argument if you don't want to. We only used it to match the
illustration in the textbook.
summary calculates the "five number summary" (actually
six numbers), described on pp. 61-69 of Wild and Seber. Some of the individual
numbers in the "five number summary" are calculated by the following four
lines
mean calculates the mean.
median calculates the median.
quantile function calculates arbitrary quantiles
(p. 244 ff. in Wild and Seber).
quantile(x, 0.25) calculates the lower quartile
(also called the 0.25 quantile or the 25th percentile)
of the variable x.
quantile(x, 0.75) calculates the lower quartile
(also called the 0.75 quantile or the 75th percentile)
of the variable x.
sd calculates the standard deviation.
IQR calculates the interquartile range (IQR).
x <- c(1, 2, 2, 5, 8, 8, 11, 12, 14)
inputs the data for this problem (we just type it in rather than read
it from some file on the web).
The symbol <- is the R assignment operator.
The function c "collects" a bunch of numbers into
one data vector.
summary command is explained in the
numerical summaries example.
fred.
fred <- c(1, 2, 2, 5, 8, 8, 11, 12, 14) summary(fred)Does exactly the same thing as the example.
Note that upper and lower case are different, that is,
Fred with a capital "F" is a different variable.
names(freq) <- nstrata associates the
names of the strata with the frequencies. The symbol <-
is the R assignment operator.
barplot command draws the barplot.
This is documented on the R on-line
help for
barplot.