GOT Analysis

Author

Sven Imdorf

Published

March 5, 2025

The analysis in got-1.R was a great success! Every human should have the right to read it!

Here it is:

# With library() the computer loads the named packages in the brackets that we need for computing. These packages include different pre-coded functions.
library("tinytex")
library("readr")
library("ggplot2")
library("dplyr")

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library("ggrepel")


# with read.csv, we load the .csv datafile and with the arrow we save it in a variable named "screentimes"
screentimes <- read_csv("GOT_screentimes_1.csv")
Rows: 191 Columns: 6
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): name, imdb_url, portrayed_by_name, portrayed_by_imdb_url
dbl (2): screentime, episodes

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# top_n() selects the top n rows based on a specified column. Here, the top 10 screentime is selected.
screentimes_high <- top_n(screentimes, 10, screentime)

# ggplot enables different plots with the data. Here, we plot a scatterplot with the screentime, the top 10 screentimes being named inside the plot
ggplot(screentimes, aes(screentime, episodes)) +
  geom_point() +
  geom_text_repel(data = screentimes_high,aes(label = name),min.segment.length = 0)
Warning: Removed 15 rows containing missing values or values outside the scale range
(`geom_point()`).

Introduction

In the following sections, the Quarto exercises will be portrayed.

Quarto Exercise 1

Isert a figure from directory:

Figure 1: House Baratheon

Quarto Exercise 2

Cross referencing to a figure:
See Figure Figure 1 for the banner of House Baratheon.

Quarto Exercise 3

Cross referencing to a section.

See section Section 1 for more information.

Quarto Exercise 4

Create subfigure layout:

(a) House Baratheon
(b) House Baylish
(c) House Arryn
(d) House Bolton
Figure 2: Houses of “A song of fire and ice” created by dezzzart

Quarto Exercise 5

Add a caption an cross reference to the ggplot-figure

Figure 3: Scatterplot of Screentime

Cross referencing to a ggplot: See Figure Figure 3 for Scatterplot of Screentime

Quarto Exercise 6

Display table with top 10 character screentime (only name, screentime, episodes), reference it in text and add caption:

hightimes <- screentimes_high[,c("name","screentime","episodes")] |> 
  knitr::kable()
hightimes
Table 1: characters with the most screentime
name screentime episodes
Tyrion Lannister 293.30 54
Jon Snow 268.15 49
Daenerys Targaryen 221.30 49
Cersei Lannister 201.45 52
Sansa Stark 199.30 47
Arya Stark 189.15 47
Jaime Lannister 162.30 43
Theon Greyjoy 123.30 39
Samwell Tarly 121.45 37
Jorah Mormont 117.30 42