library("readr")
library("ggplot2")
library("dplyr")
library("ggrepel")
#Imports the GOT dataset (source: www.imbd.com)
screentimes <- read_csv("GOT_screentimes_1.csv")
#Extract characters with the most screentime, bevause we want to lable them in ggplot
screentimes_high <- top_n(screentimes, 10, screentime) # top_n() shows highest 10Game of Thrones Characters
Introduction
In our analysis of game of thrones dataset, we compare screentime and number of starred episodes for all characters. We then label all characters with a high screentime (top 10).
Results
Using {#sec-results} will mark this section in the R document, when used “@”. Like this: Section 2
# the above code with label will mark this figure in the Quarto document as Figure 1.
# show data as a scatter plot: screentime vs. number of episodes watched
# and label characters with high screentime
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()`).
Figure 2 shows the coat of arms of house Baratheon. And the scatterplot is shown in Figure 1, see Section 2.
create subfigure: