Back to Article
Article Notebook
Download Source

Investigations into celestial escapades

Authors
Affiliations

John Little

Lillian Thurman

Stepford & Associates

Published

February 14, 2024

Abstract

Based on Quarto Manuscript work by Posit.co, C.Wickham, Purves, and Cockett, et. al.: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. …

Keywords

Births, Star Wars, Timeline

In [1]:
library(tidyverse)
Warning: package 'tidyr' was built under R version 4.3.2
Warning: package 'readr' was built under R version 4.3.2
Warning: package 'dplyr' was built under R version 4.3.2
Warning: package 'stringr' was built under R version 4.3.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(gt)
Warning: package 'gt' was built under R version 4.3.2

1 Introduction

In [2]:
births <- sort(sample(unique(dplyr::starwars$birth_year), 8))
In [3]:
set.seed(1000)
births_df <- starwars |> 
  drop_na(birth_year) |> 
  slice_sample(n = 8) 

births_df |> 
  ggplot(aes(birth_year, !is.na(birth_year))) +
  geom_point() +
  labs(x = "Year", y = "Birth") +
  theme_bw() +
  theme(axis.text.y = element_blank(),
        axis.ticks.y = element_blank()) 
An event plot of the birth years of a sample of Star Wars characters.
Figure 1: Timeline of Births in Star Wars
In [4]:
avg_years_between_births <- births_df |>
  arrange(birth_year) |> 
  mutate(diff = birth_year - lag(birth_year)) |> 
  summarise(avg = round(mean(diff, na.rm = TRUE), 1)) |> 
  pull(avg)

Based on data up to and including 2019, births in the Star Wars multiverse can be said to happen every 7.3 years on average.

In an unrelated gambit to emulate a fashion of scholarly writing, this author references, Lipset (1960). Lipset discussed the nature of democracy and the role of party representation. His paper highlights the difference in understanding of democracy between sociologists and laymen. While public opinion often emphasizes the freedom of citizens to elect representatives, sociologists focus on the social processes and elites that influence these democratic systems.

A sampling of eight births were recorded since star-date zero (Figure 1).

Data and methods are discussed in Section 2.

Let \(x\) denote the number of births in a year. Then, \(x\) can be modeled by a Poisson distribution

\[ p(x) = \frac{e^{-\lambda} \lambda^{x}}{x !} \tag{1}\]

where \(\lambda\) is the rate of births per year. Using Equation 1, the probability of a birth in the next \(t\) years can be calculated.

Below is a table generated from a data frame and presented via the {gt} package

In [5]:
In [6]:
births_df |> 
  select(name, birth_year) |> 
  gt::gt() |> 
  gt::tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
Table 1: A table of Star Wars characters and their birth years
name birth_year
Darth Vader 41.9
Lando Calrissian 31.0
Ackbar 41.0
Padmé Amidala 46.0
Mace Windu 72.0
Palpatine 82.0
Bail Prestor Organa 67.0
Darth Maul 54.0

However, as the situation demands, more basic tables can be presented with Markdown.

Table 2: Minor Star Wars characters and their hair color
Name Hair Color
Adi Gallia none
Dormé brown
Zam Wessell blonde
Taun We none
Jocasta Nu white
Shaak Ti none

Table 1 lists the birth years of a sample of Star Wars characters. Meanwhile, Table 2 summarises Minor Star Wars characters and their hair color.

Figure 2: The Epsilon Eridani system

Epsilon Eridani is visible from most of Earth’s surface. Located at a distance 10.5 light-years (3.2 parsecs) from the Sun (Figure 2).

Also notable is the ability to perform calculations in notebooks. This means multiple computation notebooks can be used in a project. Outputs and artifacts of those notebooks, then, can be embedded in the main manuscript page, or other notebooks. Below Figure 3 is an embedded figure derived from a separate notebook file.

In [7]:
starwars |> 
  filter(mass < 500) |> 
  drop_na(mass) |> 
  ggplot(aes(height, mass)) +
  geom_smooth(method = lm, se = FALSE, color = "grey80") +
  geom_jitter(aes(color = gender)) +
  scale_color_brewer(palette = "Set1",
                     na.value = "goldenrod") +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'
A scatterplot of mass over height for select characters in the _Star Wars_ franchise.
Figure 3: Starwars characters: mass over height

Figure 3 shows the relationship of mass over height for a sample of _Star Wars* characters.

2 Data & Methods

3 Conclusion

(A), Let’s not forget how cool Figure 1 is. But, (B), don’t forget (A).

References

Lipset, Seymour Martin. 1960. “Party Systems and the Representation of Social Groups.” European Journal of Sociology 1 (1): 50–85. https://doi.org/10.1017/s0003975600000059.