A recent poll of 3,057 individuals asked: “What’s the longest vacation you plan to take this summer?” The following relative frequency distribution summarizes the results.
a. Construct the frequency distribution of these data. (Round your answers to the nearest whole number.)
respon = c("A few days", "A few long weekends", "One week", "Two weeks")
relfreq = c(0.21, 0.18, 0.36, 0.25)
freq = round(relfreq * 3057, 0)
myData = data.frame(Response = respon, Frequency = freq, RelFreq = relfreq)
myData
b. Construct a bar chart for this data. (Before plotting the points, round the “Frequency” to the nearest whole number. Click on the x-axis exactly below the “0” point and then drag the bar till it reaches the correct answer.)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.6 ✓ dplyr 1.0.7
## ✓ tidyr 1.2.0 ✓ stringr 1.4.0
## ✓ readr 2.1.2 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
ggplot(myData, aes(Response, Frequency))+
geom_bar(stat="identity", color = "blue", fill="cadetblue1")+
geom_text(aes(label=Frequency), vjust=-0.3, size =4)+
labs(title = "Length of Vacations from Survey",
x = "Length of vacations",
y = "Frequency", size = 4)
