Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

T 308 Final Exam Prep – Key Concepts & Problem-Solving Strategies

Beoordeling
-
Verkocht
-
Pagina's
9
Cijfer
A+
Geüpload op
20-03-2025
Geschreven in
2024/2025

T 308 Final Exam Prep – Key Concepts & Problem-Solving Strategies

Instelling
Vak

Voorbeeld van de inhoud

ST 308 end term exam
4 types of graphical summaries (across subgroups) - 1. bar plots (categorical data)
2. histograms
3. box plots
4. scatter plots

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

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

which major system for plotting will we be using - ggplot2

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

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

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

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

ex:
size, color, x variable, y variable

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

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

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

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

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

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

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

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

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

factor - special class of vector with a levels attribute

, levels - 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 - 1. you can order the levels and give nicer labels

example of creating a new factor version of the "survived" variable - 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 -
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 - 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 - 1. convert another categorical variable to a factor for
better plotting
2. drop any rows with missing values for any of these variables

example of converting another categorical variable to a factor for better plotting -
titanicData <- titanicData%>%
mutate(myEmbarked = as.factor(embarked))
levels(titanicData$myEmbarked)<- c("Cherbourg", "Queenstown", "Southampton")

example of dropping any rows with missing values for any of these variables -
titanicData<-titanicData%>%
drop_na(mySurvived, sex, myEmbarked)

aes() - defines visual properties of objects in the plot

map variables in the data frame to plot elements:
x = , y = , size = , shape = , color = , alpha = , ...

most common properties for a given geom - d + geom_bar()

Geschreven voor

Vak

Documentinformatie

Geüpload op
20 maart 2025
Aantal pagina's
9
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$8.09
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
InsightPapers

Maak kennis met de verkoper

Seller avatar
InsightPapers Havard School
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
4
Lid sinds
1 jaar
Aantal volgers
0
Documenten
489
Laatst verkocht
4 maanden geleden
edutech papers shop selling study exams elaborations :

High-quality exams and answers, summaries, exam guides, and practice questions created for top-performing students. Perfect for boosting your grades and preparing efficiently—organized by course and institution.

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen