HW 3 Question 4 (R)

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

The following data give the numbers of specific seedlings found at the Twentieth

Century for a sample of 43 locations.


> Seedlings=c(
42,52,48,41,56,46,44,42,48,53,51,53,51,32,56,21,49,56,28,35,64,48,46,43,52,50,54,47,44,47,50,
49,52,28,36,54,41,29,35,58,42,46,27)
(a) Find the median of the data.
> median(Seedlings)
[1] 47
(b) Find the mean of the data.
> mean(Seedlings)
[1] 45.25581
(c) Find the variance of the data.
> var(Seedlings)
[1] 89.71872
(d) Find the standard deviation of the data.
> sd(Seedlings)
[1] 9.471996
(e) Find the quartiles of the data.
> quantile(Seedlings)
0% 25% 50% 75% 100%
21.0 41.5 47.0 52.0 64.0
(f) Find the 70th percentile of the data.
> quantile(Seedlings, c(.70))
70%
51
(g) Find the range of the data.
> max(Seedlings)-min(Seedlings)
[1] 43
(h) Find the interquartile range of the data
> IQR(Seedlings)
[1] 10.5
(i) Sort the data from the largest value to the smallest
> rev(sort(Seedlings))
[1] 64 58 56 56 56 54 54 53 53 52 52 52 51 51 50 50 49 49 48 48 48 47 47 46 46 46 44 44 43 42
42 [32] 42 41 41 36 35 35 32 29 28 28 27 21
(j) Draw a boxplot of the data.
> boxplot(Seedlings,main="Seedlings Found",xlab="# of Seedlings",horizontal=TRUE)
(k) Draw a histogram of the data.
> hist(Seedlings,main="Seedlings Found",xlab="# of Seedlings")

You might also like