---
title: Investigations into celestial escapades
author:
  - name: John Little
    orcid: 0000-0002-3600-0972
    corresponding: false
    roles: []
    affiliations:
      - name: Center for Data and Visualization Sciences
        url: https://library.duke.edu/data
      - name: Duke University Libraries
  - name: Lillian Thurman
    orcid: 0000-0002-0760-5497
    corresponding: true
    email: hypnotherapy@thurman.org    
    roles: []
    affiliations:
      - Stepford & Associates
keywords:
  - Births
  - Star Wars
  - Timeline
license: "CC BY"
abstract: |
  Based on [Quarto Manuscript](https://quarto.org/docs/manuscripts/) 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. ...
plain-language-summary: |
  A sample Quarto project demonstrates coding notebooks and report expression rendering...
key-points:
  - A sample of _Star Wars_ Character births were represented along a timeline
  - A different sample of the same population were scatter-plotted along an x-y axis 
  - Sample slides were generated from the report
  - An embeded analysis notebook is included and the outcomes are embedded into the main report.
date: last-modified
bibliography: references.bib
citation:
  container-title: Journal of the manipulated realms of a parallell universe
number-sections: true
---

```{r}
library(tidyverse)
library(gt)
```

## Introduction

```{r}
births <- sort(sample(unique(dplyr::starwars$birth_year), 8))
```

```{r}
#| label: fig-timeline
#| fig-cap: Timeline of Births in Star Wars
#| fig-alt: An event plot of the birth years of a sample of Star Wars characters.
#| fig-height: 1.5
#| fig-width: 6


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()) 
```

```{r}
#| label: fig-avg-years-between-births
#| output: false
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 `{r} round(avg_years_between_births, 1)` years on average.

In an unrelated gambit to emulate a fashion of scholarly writing, this author references, @lipset1960. 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 (@fig-timeline).

Data and methods are discussed in @sec-data-methods.

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 !}
$$ {#eq-poisson}

where $\lambda$ is the rate of births per year. Using @eq-poisson, 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

```{r}
#| label: tbl-births
#| tbl-cap: A table of *Star Wars* characters and their birth years
births_df |> 
  select(name, birth_year) |> 
  gt::gt() |> 
  gt::tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
```

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

| Name        | Hair Color |
|-------------|------------|
| Adi Gallia  | none       |
| Dormé       | brown      |
| Zam Wessell | blonde     |
| Taun We     | none       |
| Jocasta Nu  | white      |
| Shaak Ti    | none       |

: Minor *Star Wars* characters and their hair color {#tbl-hair-color}

@tbl-births lists the birth years of a sample of *Star Wars* characters. Meanwhile, @tbl-hair-color summarises Minor *Star Wars* characters and their hair color.

![The Epsilon Eridani system](images/epsilon_eridani_system_randyfmcdonald_cc-by-nc-sa.jpg){#fig-map}

Epsilon Eridani is visible from most of Earth's surface. Located at a distance 10.5 light-years (3.2 parsecs) from the Sun (@fig-map).

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 @fig-spatial-plot is an embedded figure derived from a separate notebook file.

{{< embed notebooks/starwars_mass-height.qmd#fig-spatial-plot >}}

@fig-spatial-plot shows the relationship of mass over height for a sample of \_Star Wars\* characters.

## Data & Methods {#sec-data-methods}

## Conclusion

(A), Let's not forget how cool @fig-timeline is. But, (B), don't forget (A).

## References {.unnumbered}

::: {#refs}
:::
