Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 10 pages
Exam (elaborations)

ST 308 QUIZ 3 QUESTIONS WITH VERIFIED ANSWERS

Document preview thumbnail
Preview 2 out of 10 pages

ST 308 QUIZ 3 QUESTIONS WITH VERIFIED ANSWERS

Content preview

ST 308 QUIZ 3 QUESTIONS WITH VERIFIED ANSWERS


4 types of graphical summaries (across subgroups) - Answers - 1. bar plots (categorical
data)
2. histograms
3. box plots
4. scatter plots

3 major systems for plotting - Answers - 1. base r (built-in functions)
2. lattice
3. ggplot2 (sort of part of the tidyverse)

lattice - Answers - great for doing multiple plots (not part of tidyverse)

which major system for plotting will we be using - Answers - ggplot2

what ggplot2 code will create a plot instance - Answers - ggplot(data = data_frame)

what functions of ggplot2 will add layers (visualization) to the plot - Answers - geom or
stat

which function in ggplot2 allows us to modify layer "mapping" args - Answers - aes()

what does it mean to modify layers - Answers - to map variables to attributes of the plot

ex:
size, color, x variable, y variable

how do you create a ggplot2 barplot - Answers - ggplot() + geom_bar()

how do you specify the categories that go across the x axis in a bar plot - Answers -
aes(x = ...)

ex:
ggplot(data = titanicData, aes(x = survived))

what must you add to the bar plot? - Answers - either geom or stat layer

ex:
ggplot(data = titanicData, aes(x = survived) + geom_bar)

general instructions for making ggplot2 bar plot - Answers - 1 - save base object with
global aes() assignments

, 2 - add layers

what does the ggplot function itself create? - Answers - a base plotting object with
global aesthetics

What symbol is used to add another layer to a ggplot object? - Answers - +

What geom layer below would be used in creating a bar plot? - Answers - geom_bar()

factor - Answers - special class of vector with a levels attribute

levels - Answers - define all possible values for that variable

ex:
define possible values 1-7 for a variable like Day which goes from monday through
sunday

- prevents r from thinking that a categorical variable is numerical

why are factors great for plotting - Answers - 1. you can order the levels and give nicer
labels

example of creating a new factor version of the "survived" variable - Answers -
titanicData <- titanicData%>%
mutate(mySurvived = as.factor(survived))
str(titanicData$mySurvived)

- "survived" has 2 levels; "0" (died) or "1"(survived).

example of creating better labels for the 2 levels of "survived" variable - Answers -
levels(titanicData$mySurvived) <- c("Died", "Survived")
levels(titanicData$mySurvived)

- turns "0" into "Died" and "1" into "Survived"

example of changing the ordering for the 2 levels of "survived" variable - Answers -
titanicData <- titanicData%>%
mutate(mySurvived = factor(mySurvived, levels = c("Survived", "Died")))
table(titanicData$mySurvived)

- puts "survived" on the left of "died", instead of the opposite original composition

2 ways to prepare our data - Answers - 1. convert another categorical variable to a
factor for better plotting
2. drop any rows with missing values for any of these variables

Document information

Uploaded on
June 5, 2026
Number of pages
10
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$14.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GEEKA
3.8
(361)
Sold
2137
Followers
1448
Items
58651
Last sold
6 days ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions