The sample data below shows the total number of automobile sales (in thousands) in the Philippines for the last 20 years.
Data: 90, 85, 80, 95, 103, 110, 115, 103, 105, 98, 93, 82, 82, 85, 90, 90, 110, 110, 115, 95.
Entering the data manually into RStudio, present a complete R script that would provide each of the following: a. Stem-and-leaf plot b. Dot plot c. Mean number of automobiles sold per year d. Median number of automobiles sold per year
\(~\)
library(pander)
library(ggplot2)
sales <- c(90, 85, 80, 95, 103, 110, 115, 103, 105, 98, 93, 82, 82, 85, 90, 90, 110, 110, 115, 95)
\(~\)
stem(sales)
The decimal point is 1 digit(s) to the right of the |
8 | 02255
9 | 0003558
10 | 335
11 | 00055
\(~\)
ID <- 1:20
data <- data.frame(ID, sales)
ggplot(data, aes(sales)) + geom_dotplot(binwidth = 1.2)
\(~\)
x1 <- mean(sales)
pander(round(x1, digits = 2))
96.8
\(~\)
x2 <- median(sales)
pander(round(x2, digits = 2))
95